From: Dave Penkler <dpenkler@gmail.com>
To: Joe Simmons-Talbott <joest@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] gpib: agilent_82357a: don't check a NULL serial string
Date: Fri, 27 Mar 2026 11:38:49 +0100 [thread overview]
Message-ID: <acZeOUn4oBE-MVy-@egonzo> (raw)
In-Reply-To: <20260326131256.1758014-1-joest@redhat.com>
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>
next prev parent reply other threads:[~2026-03-27 10:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2026-04-16 11:49 ` Joe Simmons-Talbott
2026-04-19 6:50 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=acZeOUn4oBE-MVy-@egonzo \
--to=dpenkler@gmail.com \
--cc=joest@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.