From: "Danilo Krummrich" <dakr@kernel.org>
To: "Alan Stern" <stern@rowland.harvard.edu>
Cc: "Johan Hovold" <johan@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
<driver-core@lists.linux.dev>, <linux-usb@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
"Mario Peter" <mario.peter@leica-geosystems.com>,
<stable@vger.kernel.org>
Subject: Re: [PATCH] driver core: take parent lock on deferred probe
Date: Wed, 14 Oct 2026 16:30:48 +0200 [thread overview]
Message-ID: <DM4MTGIILY95.YZSDZOIBBZZT@kernel.org> (raw)
In-Reply-To: <9803935c-11d9-48a0-8d4c-95c478a724a8@rowland.harvard.edu>
On Wed Oct 14, 2026 at 4:38 AM CEST, Alan Stern wrote:
> I was going to suggest that the driver core could acquire and release
> these extra references automatically for devices on a bus with
> need_parent_lock set, but it looks like that can't be done because the
> bus_type might not yet be set when device_initialize() runs.
>
> However, is there any real reason why the driver core wouldn't want to
> guarantee that dev->parent will be a valid pointer up until the time
> when dev is released? For every device that has a parent, not just USB?
I'm not sure we don't have any cases where this would create cyclic reference
counts. Like with the kobject API, the separate device_del() step would break
circular reference counts.
From a quick check ALSA seems to have this cyclic topology.
> 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.
next prev parent reply other threads:[~2026-10-14 14:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 14:06 [PATCH] driver core: take parent lock on deferred probe Johan Hovold
2026-10-13 17:43 ` Danilo Krummrich
2026-10-13 19:11 ` Alan Stern
2026-10-13 21:01 ` Danilo Krummrich
2026-10-14 2:38 ` Alan Stern
2026-10-14 14:30 ` Danilo Krummrich [this message]
2026-10-14 14:51 ` Johan Hovold
2026-10-14 8:15 ` Johan Hovold
2026-10-14 14:42 ` Danilo Krummrich
2026-10-14 15:14 ` Johan Hovold
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=DM4MTGIILY95.YZSDZOIBBZZT@kernel.org \
--to=dakr@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mario.peter@leica-geosystems.com \
--cc=rafael@kernel.org \
--cc=stable@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/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