From 6be50f680a3b2e3c87ac5faf5eddf44bb3ad6558 Mon Sep 17 00:00:00 2001 From: Joe Simmons-Talbott Date: Thu, 26 Mar 2026 09:12:56 -0400 Subject: [PATCH] gpib: agilent_82357a: don't check a NULL serial string The agilent_82357a driver uses the USB device serial string for device matching but does not verify that the string exists before passing it to strcmp(). Verify that the device has a serial number before accessing it to avoid triggering a NULL-pointer dereference with devices that don't provide a serial number (iSerialNumber = 0). Similar to commit aa79f996eb41 ("i2c: cp2615: fix serial string NULL-deref at probe"). Found by Claude:sonnet-4.5 Signed-off-by: Joe Simmons-Talbott Acked-by: Dave Penkler Link: https://patch.msgid.link/20260326131256.1758014-1-joest@redhat.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpib/agilent_82357a/agilent_82357a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpib/agilent_82357a/agilent_82357a.c b/drivers/gpib/agilent_82357a/agilent_82357a.c index 770ba6eb40d1..2468a471d175 100644 --- a/drivers/gpib/agilent_82357a/agilent_82357a.c +++ b/drivers/gpib/agilent_82357a/agilent_82357a.c @@ -1298,7 +1298,7 @@ static inline int agilent_82357a_device_match(struct usb_interface *interface, if (gpib_match_device_path(&interface->dev, config->device_path) == 0) return 0; if (config->serial_number && - strcmp(usbdev->serial, config->serial_number) != 0) + (!usbdev->serial || strcmp(usbdev->serial, config->serial_number) != 0)) return 0; return 1;