Re: [PATCH v2] driver core: Take parent lock in async device attach
From: Johan Hovold
Date: Mon Oct 12 2026 - 11:32:25 EST
On Mon, Oct 12, 2026 at 04:13:16PM +0200, Danilo Krummrich wrote:
> On Mon Oct 12, 2026 at 2:50 PM CEST, Johan Hovold wrote:
> > On Wed, Oct 07, 2026 at 01:15:14PM +0000, Mario Peter wrote:
> >> Take the parent lock in __device_attach_async_helper() as well, like
> >> __driver_attach_async_helper() does, and move
> >> __device_driver_lock/unlock() up for that. With this the warning was
> >> gone in 300 boots on the board and in 6000 iterations in QEMU.
> > Thanks for fixing this, USB interfaces should indeed always be probed
> > with the parent lock held:
>
> I was about to pick this up, but can't this cause a subtle deadlock? What if
> async_schedule_dev() runs synchronously? Wouldn't we then attempt to take the
> parent lock again while e.g. bConfigurationValue_store() already holds it?
Hmm. Good catch. I guess we need to switch to
async_schedule_dev_nocall() and retry with explicit synchronous probe on
errors.
Johan