[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2026013133-tamale-massager-3c76@gregkh>
Date: Sat, 31 Jan 2026 13:15:53 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Guan-Yu Lin <guanyulin@...gle.com>
Cc: mathias.nyman@...el.com, stern@...land.harvard.edu,
wesley.cheng@....qualcomm.com, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [RFC PATCH] usb: host: xhci-sideband: fix deadlock in unregister
path
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
Powered by blists - more mailing lists