From: Greg KH <gregkh@linuxfoundation.org>
To: Jeffin Philip <jeffinphilip14@gmail.com>
Cc: valentina.manea.m@gmail.com, shuah@kernel.org, i@zenithal.me,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org,
syzbot+af76b01c9a0f0ab60fb0@syzkaller.appspotmail.com
Subject: Re: [PATCH v3 1/2] usbip: usbip_host: fix null pointer dereference in rebind_store
Date: Mon, 31 Aug 2026 12:04:45 +0200 [thread overview]
Message-ID: <2026083141-morbidly-swiftness-9f8f@gregkh> (raw)
In-Reply-To: <20260811160541.29461-2-jeffinphilip14@gmail.com>
On Tue, Aug 11, 2026 at 09:35:40PM +0530, Jeffin Philip wrote:
> rebind_store drops locks to execute do_rebind which sleeps
> during which time udev may become NULL due to physical disconnect.
> Since this cannot be prevented and spinlocks cannot be obtained
> in do_rebind, we turn towards the function that performs the
> same action, drivers_probe, safely. Remove rebind_store and print a
> warning to the user to use drivers_probe instead as a safer
> alternative.
>
> Reported-by: syzbot+af76b01c9a0f0ab60fb0@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=af76b01c9a0f0ab60fb0
> Fixes: 4bfb141bc013 ("usbip: usbip_host: fix to hold parent lock for device_attach() calls")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jeffin Philip <jeffinphilip14@gmail.com>
> ---
> Changes in v3:
> - Addressed the race condition proposed by Greg KH in v2
> discussion.
> Changes in v2:
> - Addressed concerns raised by the Greg KH in v1 discussion
> - Added usb_get_dev() to get a reference to udev preventing
> it from becoming null after the null check. Drop the reference
> after using it in do_rebind()
> v1:
> - Initial patch with a udev null check that returns -ENODEV if udev
> is null.
> ---
> drivers/usb/usbip/stub_main.c | 27 +--------------------------
> 1 file changed, 1 insertion(+), 26 deletions(-)
>
> diff --git a/drivers/usb/usbip/stub_main.c b/drivers/usb/usbip/stub_main.c
> index 79110a69d697..013f1563b1e9 100644
> --- a/drivers/usb/usbip/stub_main.c
> +++ b/drivers/usb/usbip/stub_main.c
> @@ -242,32 +242,7 @@ static void stub_device_rebind(void)
> static ssize_t rebind_store(struct device_driver *dev, const char *buf,
> size_t count)
> {
> - int ret;
> - int len;
> - struct bus_id_priv *bid;
> -
> - /* buf length should be less that BUSID_SIZE */
> - len = strnlen(buf, BUSID_SIZE);
> -
> - if (!(len < BUSID_SIZE))
> - return -EINVAL;
> -
> - bid = get_busid_priv(buf);
> - if (!bid)
> - return -ENODEV;
> -
> - /* mark the device for deletion so probe ignores it during rescan */
> - bid->status = STUB_BUSID_OTHER;
> - /* release the busid lock */
> - put_busid_priv(bid);
> -
> - ret = do_rebind((char *) buf, bid);
> - if (ret < 0)
> - return ret;
> -
> - /* delete device from busid_table */
> - del_match_busid((char *) buf);
> -
> + pr_warn("rebind node is deprecated, consider using drivers_probe instead\n");
No one will ever notice this, just remove the sysfs file entirely if
you really think it is ok to remove the functionality. That way
userspace will notice and handle it properly (hopefully...)
But, are you sure it is ok to remove this user/kernel api? What about
workflows that are using it?
thanks,
greg k-h
next prev parent reply other threads:[~2026-08-31 10:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 16:05 [PATCH v3 0/2] usbip: usbip_host: remove legacy rebind_store in favor of drivers_probe Jeffin Philip
2026-08-11 16:05 ` [PATCH v3 1/2] usbip: usbip_host: fix null pointer dereference in rebind_store Jeffin Philip
2026-08-31 10:04 ` Greg KH [this message]
2026-08-31 10:25 ` Jeffin Philip
2026-08-11 16:05 ` [PATCH v3 2/2] usbip: tools: replace faulty rebind_store with drivers_probe Jeffin Philip
2026-08-11 22:53 ` [PATCH v3 0/2] usbip: usbip_host: remove legacy rebind_store in favor of drivers_probe Shuah Khan
2026-08-12 2:40 ` Jeffin Philip
2026-08-12 19:31 ` Shuah Khan
2026-08-12 19:42 ` Jeffin Philip
2026-08-20 10:18 ` Jeffin Philip
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=2026083141-morbidly-swiftness-9f8f@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=i@zenithal.me \
--cc=jeffinphilip14@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=stable@vger.kernel.org \
--cc=syzbot+af76b01c9a0f0ab60fb0@syzkaller.appspotmail.com \
--cc=valentina.manea.m@gmail.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®