From: syzbot <syzbot+af76b01c9a0f0ab60fb0@syzkaller.appspotmail.com>
To: lucas.pascal@pqshield.com
Cc: lucas.pascal@pqshield.com, syzkaller-bugs@googlegroups.com,
linux-kernel@vger.kernel.org
Subject: Re: [syzbot] [usb?] general protection fault in rebind_store
Date: Fri, 27 Nov 2026 05:25:34 -0800 [thread overview]
Message-ID: <6b0984ce.2fe6adf2.56c42.3878.GAE@google.com> (raw)
In-Reply-To: <20261127132532.336180-1-lucas.pascal@pqshield.com>
> #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
Patch testing via #syz test is temporarily disabled.
See https://github.com/google/syzkaller/issues/8122 for details.
>
> diff --git a/drivers/usb/usbip/stub.h b/drivers/usb/usbip/stub.h
> index d11270560c24..ab5726eeed29 100644
> --- a/drivers/usb/usbip/stub.h
> +++ b/drivers/usb/usbip/stub.h
> @@ -75,7 +75,6 @@ struct bus_id_priv {
> char status;
> int interf_count;
> struct stub_device *sdev;
> - struct usb_device *udev;
> char shutdown_busid;
> spinlock_t busid_lock;
> };
> diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c
> index abfa11d6bde7..b03c77d598e8 100644
> --- a/drivers/usb/usbip/stub_dev.c
> +++ b/drivers/usb/usbip/stub_dev.c
> @@ -371,7 +371,6 @@ static int stub_probe(struct usb_device *udev)
> dev_set_drvdata(&udev->dev, sdev);
>
> busid_priv->sdev = sdev;
> - busid_priv->udev = udev;
>
> save_status = busid_priv->status;
> busid_priv->status = STUB_BUSID_ALLOC;
> diff --git a/drivers/usb/usbip/stub_main.c b/drivers/usb/usbip/stub_main.c
> index 01452f7bdabb..563c92ab88e7 100644
> --- a/drivers/usb/usbip/stub_main.c
> +++ b/drivers/usb/usbip/stub_main.c
> @@ -196,18 +196,28 @@ static ssize_t match_busid_store(struct device_driver *dev, const char *buf,
> }
> static DRIVER_ATTR_RW(match_busid);
>
> -static int do_rebind(char *busid, struct bus_id_priv *busid_priv)
> +static int do_rebind(char *busid)
> {
> + struct device *dev;
> int ret = 0;
>
> + /*
> + * Look the device up by name: it may have been disconnected and
> + * freed since it was bound to usbip-host.
> + */
> + dev = bus_find_device_by_name(stub_driver.driver.bus, NULL, busid);
> + if (!dev)
> + return -ENODEV;
> +
> /* device_attach() callers should hold parent lock for USB */
> - if (busid_priv->udev->dev.parent)
> - device_lock(busid_priv->udev->dev.parent);
> - ret = device_attach(&busid_priv->udev->dev);
> - if (busid_priv->udev->dev.parent)
> - device_unlock(busid_priv->udev->dev.parent);
> + if (dev->parent)
> + device_lock(dev->parent);
> + ret = device_attach(dev);
> + if (dev->parent)
> + device_unlock(dev->parent);
> if (ret < 0)
> - dev_err(&busid_priv->udev->dev, "rebind failed\n");
> + dev_err(dev, "rebind failed\n");
> + put_device(dev);
> return ret;
> }
>
> @@ -232,8 +242,7 @@ static void stub_device_rebind(void)
> for (i = 0; i < MAX_BUSID; i++) {
> if (busid_table[i].name[0] &&
> busid_table[i].shutdown_busid) {
> - busid_priv = &(busid_table[i]);
> - do_rebind(busid_table[i].name, busid_priv);
> + do_rebind(busid_table[i].name);
> }
> }
> #endif
> @@ -261,8 +270,9 @@ static ssize_t rebind_store(struct device_driver *dev, const char *buf,
> /* release the busid lock */
> put_busid_priv(bid);
>
> - ret = do_rebind((char *) buf, bid);
> - if (ret < 0)
> + ret = do_rebind((char *) buf);
> + /* a device disconnected meanwhile has nothing to rebind */
> + if (ret < 0 && ret != -ENODEV)
> return ret;
>
> /* delete device from busid_table */
next parent reply other threads:[~2026-11-27 13:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20261127132532.336180-1-lucas.pascal@pqshield.com>
2026-11-27 13:25 ` syzbot [this message]
2026-08-01 0:36 syzbot
2026-08-19 14:59 ` syzbot
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=6b0984ce.2fe6adf2.56c42.3878.GAE@google.com \
--to=syzbot+af76b01c9a0f0ab60fb0@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lucas.pascal@pqshield.com \
--cc=syzkaller-bugs@googlegroups.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®