can: etas_es58x: fix potential NULL pointer dereference on udev->serial
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 <kangyan91@outlook.com>
Reported-by: yue sun <samsun1006219@gmail.com>
Closes: https://lore.kernel.org/linux-can/SY8P300MB0421E0013C0EBD2AA46BA709A1F42@SY8P300MB0421.AUSP300.PROD.OUTLOOK.COM/
Fixes: 9f06631c3f
("can: etas_es58x: export product information through devlink_ops::info_get()")
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://patch.msgid.link/20250204154859.9797-2-mailhol.vincent@wanadoo.fr
Cc: stable@vger.kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
parent
257a2cd3eb
commit
a1ad2109ce
1 changed files with 5 additions and 1 deletions
|
@ -248,7 +248,11 @@ static int es58x_devlink_info_get(struct devlink *devlink,
|
|||
return ret;
|
||||
}
|
||||
|
||||
return devlink_info_serial_number_put(req, es58x_dev->udev->serial);
|
||||
if (es58x_dev->udev->serial)
|
||||
ret = devlink_info_serial_number_put(req,
|
||||
es58x_dev->udev->serial);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
const struct devlink_ops es58x_dl_ops = {
|
||||
|
|
Loading…
Add table
Reference in a new issue