Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 4a7695429ead ("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: Johan Hovold <johan@kernel.org>
Reviewed-by: Bence Csókás <bence98@sch.bme.hu>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260309075016.25612-1-johan@kernel.org

authored by

Johan Hovold and committed by
Andi Shyti
aa79f996 f338e773

+3
+3
drivers/i2c/busses/i2c-cp2615.c
··· 298 298 if (!adap) 299 299 return -ENOMEM; 300 300 301 + if (!usbdev->serial) 302 + return -EINVAL; 303 + 301 304 strscpy(adap->name, usbdev->serial, sizeof(adap->name)); 302 305 adap->owner = THIS_MODULE; 303 306 adap->dev.parent = &usbif->dev;