From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
"Masami Hiramatsu (Google)" <mhiramat@kernel.org>,
driver-core@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] driver core: fix race between bus_remove_driver() and dev_driver_uevent()
Date: Wed, 04 Nov 2026 17:21:07 -0800 [thread overview]
Message-ID: <21f4cbf39c7872893f8f2d3bfde7d829@gmail.com> (raw)
In-Reply-To: <2026101409-unkind-ablaze-08a3@gregkh>
Hi Greg,
On Wed, Oct 14, 2026 at 02:16:50PM +0200, Greg Kroah-Hartman wrote:
> On Tue, Oct 13, 2026 at 11:11:33PM -0700, Dmitry Torokhov wrote:
> > On Wed, Oct 14, 2026 at 07:31:19AM +0200, Greg Kroah-Hartman wrote:
> > > On Tue, Oct 13, 2026 at 08:24:20PM -0700, Dmitry Torokhov wrote:
> > > > @@ -830,6 +830,15 @@ void bus_remove_driver(struct device_driver *drv)
> > > > driver_remove_file(drv, &driver_attr_uevent);
> > > > klist_remove(&drv->p->knode_bus);
> > > > driver_detach(drv);
> > > > +
> > > > + /*
> > > > + * Ensure that any concurrent dev_driver_uevent() that observed
> > > > + * dev->driver before driver_detach() cleared it, finishes
> > > > + * accessing drv->name.
> > > > + */
> > > > + scoped_guard(spinlock, &sp->klist_drivers.k_lock) {
> > > > + }
> > >
> > > Shouldn't the compiler just no-op this away into nothing?
> >
> > It better not. Why would it?
>
> Sorry, early morning before my coffee had kicked in, I was thinking a
> simple lock/unlock pair without any data in the middle might be compiled
> away...
>
> Still feels odd though I don't have a better idea.
Just a gentle ping on this patch. Could it be picked up, or would you
prefer a plain spin_lock()/spin_unlock() pair instead of the empty
scoped_guard() block?
Thanks.
--
Dmitry
next prev parent reply other threads:[~2026-11-05 1:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 3:24 [PATCH] driver core: fix race between bus_remove_driver() and dev_driver_uevent() Dmitry Torokhov
2026-10-14 5:31 ` Greg Kroah-Hartman
2026-10-14 6:11 ` Dmitry Torokhov
2026-10-14 12:16 ` Greg Kroah-Hartman
2026-11-05 1:21 ` Dmitry Torokhov [this message]
2026-11-05 1:48 ` Danilo Krummrich
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=21f4cbf39c7872893f8f2d3bfde7d829@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=rafael@kernel.org \
/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.