Re: [PATCH] driver core: take parent lock on deferred probe

From: Johan Hovold

Date: Wed Oct 14 2026 - 10:57:02 EST


On Wed, Oct 14, 2026 at 04:30:48PM +0200, Danilo Krummrich wrote:
> On Wed Oct 14, 2026 at 4:38 AM CEST, Alan Stern wrote:

> > On the other hand, there's something a bit weird about this whole thing.
> > The problem arises when you want to probe a device whose parent has been
> > deleted. Isn't there some sort of protection to prevent that from ever
> > happening? I mean, doesn't deleting a device imply that all its
> > descendants have been (or are in the process of being) deleted? And of
> > course, deleting and probing are mutually exclusive -- they can't race,
> > right?
>
> Yes, that's what the dev->p->dead check under the device lock protects against.
> But the new code accesses dev->parent before acquiring the device lock and
> reaching that check.

It's not just the new code; we have the same issue in __driver_attach()
bus_rescan_devices_helper() for synchronous probe too.

Johan