From: Greg KH <gregkh@linuxfoundation.org>
To: Guan-Yu Lin <guanyulin@google.com>
Cc: mathias.nyman@intel.com, stern@rowland.harvard.edu,
wesley.cheng@oss.qualcomm.com, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [RFC PATCH] usb: host: xhci-sideband: fix deadlock in unregister path
Date: Sat, 31 Jan 2026 13:15:53 +0100 [thread overview]
Message-ID: <2026013133-tamale-massager-3c76@gregkh> (raw)
In-Reply-To: <20260130074746.287750-1-guanyulin@google.com>
On Fri, Jan 30, 2026 at 07:47:46AM +0000, Guan-Yu Lin wrote:
> When a USB device is disconnected or a driver is unbound, the USB core
> invokes the driver's disconnect callback while holding the udev device
> lock. If the driver calls xhci_sideband_unregister(), it eventually
> reaches usb_offload_put(), which attempts to acquire the same udev
> lock, resulting in a self-deadlock.
>
> Introduce lockless variants __usb_offload_get() and __usb_offload_put()
> to allow modifying the offload usage count when the device lock is
> already held. These helpers use device_lock_assert() to ensure callers
> meet the locking requirements.
Ugh. Didn't I warn about this when the original functions were added?
Adding functions with __ is a mess, please make these names, if you
_REALLY_ need them, obvious that this is a no lock function.
And now that you added the lockless functions, are there any in-kernel
users of the locked versions? At a quick glance I didn't see them, did
I miss it somewhere?
thanks,
greg k-h
next prev parent reply other threads:[~2026-01-31 12:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-30 7:47 [RFC PATCH] usb: host: xhci-sideband: fix deadlock in unregister path Guan-Yu Lin
2026-01-31 12:15 ` Greg KH [this message]
2026-02-02 10:03 ` Guan-Yu Lin
2026-02-03 14:14 ` Mathias Nyman
2026-02-04 9:15 ` Guan-Yu Lin
2026-02-04 9:53 ` Mathias Nyman
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=2026013133-tamale-massager-3c76@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=guanyulin@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=stable@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=wesley.cheng@oss.qualcomm.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