* [PATCH] gpib: agilent_82357a: don't check a NULL serial string
@ 2026-03-26 13:12 Joe Simmons-Talbott
2026-03-27 10:38 ` Dave Penkler
0 siblings, 1 reply; 4+ messages in thread
From: Joe Simmons-Talbott @ 2026-03-26 13:12 UTC (permalink / raw)
To: Dave Penkler; +Cc: linux-kernel, Joe Simmons-Talbott
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 <joest@redhat.com>
---
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 e1349afbf933..da046ea40f11 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;
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] gpib: agilent_82357a: don't check a NULL serial string
2026-03-26 13:12 [PATCH] gpib: agilent_82357a: don't check a NULL serial string Joe Simmons-Talbott
@ 2026-03-27 10:38 ` Dave Penkler
2026-04-16 11:49 ` Joe Simmons-Talbott
0 siblings, 1 reply; 4+ messages in thread
From: Dave Penkler @ 2026-03-27 10:38 UTC (permalink / raw)
To: Joe Simmons-Talbott; +Cc: linux-kernel
On Thu, Mar 26, 2026 at 09:12:56AM -0400, Joe Simmons-Talbott wrote:
> 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 <joest@redhat.com>
> ---
> 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 e1349afbf933..da046ea40f11 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;
> --
> 2.53.0
>
Acked-by: Dave Penkler <dpenkler@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gpib: agilent_82357a: don't check a NULL serial string
2026-03-27 10:38 ` Dave Penkler
@ 2026-04-16 11:49 ` Joe Simmons-Talbott
2026-04-19 6:50 ` Greg Kroah-Hartman
0 siblings, 1 reply; 4+ messages in thread
From: Joe Simmons-Talbott @ 2026-04-16 11:49 UTC (permalink / raw)
To: Dave Penkler; +Cc: Joe Simmons-Talbott, linux-kernel, Greg Kroah-Hartman
On Fri, Mar 27, 2026 at 11:38:49AM +0100, Dave Penkler wrote:
> On Thu, Mar 26, 2026 at 09:12:56AM -0400, Joe Simmons-Talbott wrote:
> > 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 <joest@redhat.com>
> > ---
> > 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 e1349afbf933..da046ea40f11 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;
> > --
> > 2.53.0
> >
> Acked-by: Dave Penkler <dpenkler@gmail.com>
>
+Greg
Hi Greg,
Sorry I neglected to include you on the original patch submission. Are
you able to either take this patch or point me to the proper person?
Thanks,
Joe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gpib: agilent_82357a: don't check a NULL serial string
2026-04-16 11:49 ` Joe Simmons-Talbott
@ 2026-04-19 6:50 ` Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2026-04-19 6:50 UTC (permalink / raw)
To: Joe Simmons-Talbott; +Cc: Dave Penkler, linux-kernel
On Thu, Apr 16, 2026 at 07:49:12AM -0400, Joe Simmons-Talbott wrote:
> On Fri, Mar 27, 2026 at 11:38:49AM +0100, Dave Penkler wrote:
> > On Thu, Mar 26, 2026 at 09:12:56AM -0400, Joe Simmons-Talbott wrote:
> > > 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 <joest@redhat.com>
> > > ---
> > > 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 e1349afbf933..da046ea40f11 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;
> > > --
> > > 2.53.0
> > >
> > Acked-by: Dave Penkler <dpenkler@gmail.com>
> >
>
> +Greg
>
> Hi Greg,
>
> Sorry I neglected to include you on the original patch submission. Are
> you able to either take this patch or point me to the proper person?
I can take it after -rc1 is out, thanks.
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-19 6:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-26 13:12 [PATCH] gpib: agilent_82357a: don't check a NULL serial string Joe Simmons-Talbott
2026-03-27 10:38 ` Dave Penkler
2026-04-16 11:49 ` Joe Simmons-Talbott
2026-04-19 6:50 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox