Skip to content

Commit 75968ac

Browse files
vincent-mailholgregkh
authored andcommitted
can: etas_es58x: fix potential NULL pointer dereference on udev->serial
commit a1ad210 upstream. The driver assumed that es58x_dev->udev->serial could never be NULL. While this is true on commercially available devices, an attacker could spoof the device identity providing a NULL USB serial number. That would trigger a NULL pointer dereference. Add a check on es58x_dev->udev->serial before accessing it. Reported-by: yan kang <[email protected]> Reported-by: yue sun <[email protected]> Closes: https://lore.kernel.org/linux-can/SY8P300MB0421E0013C0EBD2AA46BA709A1F42@SY8P300MB0421.AUSP300.PROD.OUTLOOK.COM/ Fixes: 9f06631 ("can: etas_es58x: export product information through devlink_ops::info_get()") Signed-off-by: Vincent Mailhol <[email protected]> Link: https://patch.msgid.link/[email protected] Cc: [email protected] Signed-off-by: Marc Kleine-Budde <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6c3c007 commit 75968ac

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/net/can/usb/etas_es58x/es58x_devlink.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,11 @@ static int es58x_devlink_info_get(struct devlink *devlink,
248248
return ret;
249249
}
250250

251-
return devlink_info_serial_number_put(req, es58x_dev->udev->serial);
251+
if (es58x_dev->udev->serial)
252+
ret = devlink_info_serial_number_put(req,
253+
es58x_dev->udev->serial);
254+
255+
return ret;
252256
}
253257

254258
const struct devlink_ops es58x_dl_ops = {

0 commit comments

Comments
 (0)