Unverified Commit aa79f996 authored by Johan Hovold's avatar Johan Hovold Committed by Andi Shyti
Browse files

i2c: cp2615: fix serial string NULL-deref at probe



The cp2615 driver uses the USB device serial string as the i2c adapter
name but does not make sure that the string exists.

Verify that the device has a serial number before accessing it to avoid
triggering a NULL-pointer dereference (e.g. with malicious devices).

Fixes: 4a769542 ("i2c: cp2615: add i2c driver for Silicon Labs' CP2615 Digital Audio Bridge")
Cc: stable@vger.kernel.org	# 5.13
Cc: Bence Csókás <bence98@sch.bme.hu>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Reviewed-by: default avatarBence Csókás <bence98@sch.bme.hu>
Signed-off-by: default avatarAndi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260309075016.25612-1-johan@kernel.org
parent f338e773
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -298,6 +298,9 @@ cp2615_i2c_probe(struct usb_interface *usbif, const struct usb_device_id *id)
	if (!adap)
		return -ENOMEM;

	if (!usbdev->serial)
		return -EINVAL;

	strscpy(adap->name, usbdev->serial, sizeof(adap->name));
	adap->owner = THIS_MODULE;
	adap->dev.parent = &usbif->dev;