From: "Danilo Krummrich" <dakr@kernel.org>
To: "Johan Hovold" <johan@kernel.org>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
"Alan Stern" <stern@rowland.harvard.edu>,
<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: Tue, 13 Oct 2026 19:43:08 +0200 [thread overview]
Message-ID: <DM3WA69YX6WE.2Q4DY9MIU7A0L@kernel.org> (raw)
In-Reply-To: <20261013140615.1226992-1-johan@kernel.org>
On Tue Oct 13, 2026 at 4:06 PM CEST, Johan Hovold wrote:
> +void bus_probe_device_deferred(struct device *dev)
> +{
> + if (dev->parent && dev->bus->need_parent_lock)
> + device_lock(dev->parent);
This looks like it has the same potential UAF as the other patch. It's quite
unfortunate we need the whole need_parent_lock thing just for USB. IIUC the
main reason USB needs this is because interface devices share resources of USB
devices and we need to keep the locking order to avoid inversions, right? Is
there more to this from the USB side of things?
I think we can probably do something like this
struct device *parent = NULL;
scoped_guard(device, dev) {
if (dev->p->dead)
return;
if (dev->bus->need_parent_lock)
parent = get_device(dev->parent);
}
to avoid the problem, but it's still a bit ugly.
> + __bus_probe_device(dev);
> + if (dev->parent && dev->bus->need_parent_lock)
> + device_unlock(dev->parent);
> +}
prev parent reply other threads:[~2026-10-13 17:43 UTC|newest]
Thread overview: 3+ 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 14:24 ` sashiko-bot
2026-10-13 17:43 ` Danilo Krummrich [this message]
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=DM3WA69YX6WE.2Q4DY9MIU7A0L@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.