From: Michael Kelley <mhklinux@outlook.com>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Johan Hovold <johan@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
David Lechner <dlechner@baylibre.com>,
Armin Wolf <W_Armin@gmx.de>,
Thierry Reding <thierry.reding@kernel.org>,
"Mike Rapoport (Microsoft)" <rppt@kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
Karl Mehltretter <kmehltretter@gmail.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
"Borislav Petkov (AMD)" <bp@alien8.de>,
Dapeng Mi <dapeng1.mi@linux.intel.com>,
Marco Elver <elver@google.com>,
Ethan Nelson-Moore <enelsonmoore@gmail.com>,
Jeff Layton <jlayton@kernel.org>,
Bradley Morgan <brads@mainlining.org>,
Andrew Morton <akpm@linux-foundation.org>,
Petr Mladek <pmladek@suse.com>,
Pnina Feder <pnina.feder@mobileye.com>,
Mete Durlu <meted@linux.ibm.com>,
Aaron Tomlin <atomlin@atomlin.com>,
Rio <rioo.tsukatsukii@gmail.com>,
Feng Tang <feng.tang@linux.alibaba.com>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"driver-core@lists.linux.dev" <driver-core@lists.linux.dev>,
"linux-trace-kernel@vger.kernel.org"
<linux-trace-kernel@vger.kernel.org>,
Mark Brown <broonie@kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>,
Alex Williamson <alex@shazbot.org>
Subject: RE: [PATCH] driver core: Disable driver overriding by default
Date: Wed, 18 Nov 2026 15:45:03 +0000 [thread overview]
Message-ID: <MN2PR02MB68630EC3F041DCF581083594D47A2@MN2PR02MB6863.namprd02.prod.outlook.com> (raw)
In-Reply-To: <av1UwuDq9JJkEYkN@monoceros>
From: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Sent: Tuesday, November 17, 2026 11:44 PM
>
> On Wed, Nov 18, 2026 at 05:51:29AM +0000, Michael Kelley wrote:
> > From: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Sent: Monday, November 16, 2026 3:09 AM
[snip]
> > > +/**
> > > + * device_match_driver_override() - Match a driver against the device's driver_override.
> > > + * @dev: device to check
> > > + * @drv: driver to match against
> > > + *
> > > + * Returns > 0 if a driver override is set and matches the given driver, 0 if a
> > > + * driver override is set but does not match, or < 0 if a driver override is not
> > > + * set at all.
> >
> > Additionally, returns < 0 if a matching override exists but is disallowed.
>
> Yeah, that comment is just taken unmodified from the old location of
> device_match_driver_override(). Indeed needs adaption.
>
> > > + */
> > > +int device_match_driver_override(struct device *dev,
> > > + const struct device_driver *drv)
> > > +{
> > > + guard(spinlock)(&dev->driver_override.lock);
> > > + if (dev->driver_override.name) {
> > > + int ret = !strcmp(dev->driver_override.name, drv->name);
> > > +
> > > + if (ret > 0 && !drv->support_driver_override) {
> >
> > Using "ret > 0" seems a bit odd since the value is essentially Boolean.
> > Suggest using just "ret".
>
> ok
>
> > > + if (allow_driver_override) {
> > > + add_taint_module(drv->owner,
> > > + TAINT_DRIVER_OVERRIDE, LOCKDEP_STILL_OK);
> > > + } else {
> > > + /*
> > > + * If you hit this warning and you need to
> > > + * quickly workaround this check, boot with
> > > + * allow_driver_override=1 on the kernel
> > > + * commandline. The right fix is to set the
> > > + * driver's .support_driver_override property.
> > > + */
> > > + dev_warn(dev, "Suppressed driver override binding to %s.\n", drv->name);
> >
> > Maybe "Disallowed" instead of "Suppressed" in the message? Even better,
> > could the name of the device be provided? For example,
> >
> > "Disallowed bind of driver %s to device %s using driver override"
>
> dev_warn() emits the device name.
Oh, right. Ignore my comment about the device name. I just tried it
with a Hyper-V VMBus synthetic device, and here's the output, which
is fine:
[ 80.105203] vmbus 0f749bd1-5637-4279-91f1-bde768dd030f: Suppressed driver override binding to uio_hv_generic.
VMBus device names are full GUIDs, which isn't super handy, but it
is what it is. :-(
Michael
next prev parent reply other threads:[~2026-11-18 15:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 11:08 Uwe Kleine-König
2026-11-18 5:51 ` Michael Kelley
2026-11-18 7:43 ` Uwe Kleine-König
2026-11-18 15:45 ` Michael Kelley [this message]
2026-11-18 16:04 ` Bradley Morgan
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=MN2PR02MB68630EC3F041DCF581083594D47A2@MN2PR02MB6863.namprd02.prod.outlook.com \
--to=mhklinux@outlook.com \
--cc=W_Armin@gmx.de \
--cc=akpm@linux-foundation.org \
--cc=alex@shazbot.org \
--cc=arnd@arndb.de \
--cc=atomlin@atomlin.com \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=brads@mainlining.org \
--cc=broonie@kernel.org \
--cc=corbet@lwn.net \
--cc=dakr@kernel.org \
--cc=dapeng1.mi@linux.intel.com \
--cc=dlechner@baylibre.com \
--cc=driver-core@lists.linux.dev \
--cc=elver@google.com \
--cc=enelsonmoore@gmail.com \
--cc=feng.tang@linux.alibaba.com \
--cc=gregkh@linuxfoundation.org \
--cc=jlayton@kernel.org \
--cc=johan@kernel.org \
--cc=kmehltretter@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=meted@linux.ibm.com \
--cc=mhiramat@kernel.org \
--cc=paulmck@kernel.org \
--cc=pmladek@suse.com \
--cc=pnina.feder@mobileye.com \
--cc=rafael@kernel.org \
--cc=rdunlap@infradead.org \
--cc=rioo.tsukatsukii@gmail.com \
--cc=rostedt@goodmis.org \
--cc=rppt@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=thierry.reding@kernel.org \
--cc=u.kleine-koenig@baylibre.com \
/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
all inboxes | Powered by JetHome®