lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2026012302-nutmeg-grandly-1a09@gregkh>
Date: Fri, 23 Jan 2026 16:23:29 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Danilo Krummrich <dakr@...nel.org>
Cc: rafael@...nel.org, broonie@...nel.org, will@...nel.org,
	grygorii.strashko@...com, ssantosh@...nel.org, khilman@...nel.org,
	linusw@...nel.org, brgl@...nel.org, driver-core@...ts.linux.dev,
	linux-kernel@...r.kernel.org, linux-omap@...r.kernel.org,
	linux-gpio@...r.kernel.org
Subject: Re: [PATCH] gpio: omap: do not register driver in probe()

On Fri, Jan 23, 2026 at 03:25:43PM +0100, Danilo Krummrich wrote:
> On Fri Jan 23, 2026 at 3:19 PM CET, Greg KH wrote:
> > On Fri, Jan 23, 2026 at 02:57:45PM +0100, Danilo Krummrich wrote:
> >> On Fri Jan 23, 2026 at 2:31 PM CET, Danilo Krummrich wrote:
> >> > diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> >> > index e136e81794df..8db71a2db9ff 100644
> >> > --- a/drivers/gpio/gpio-omap.c
> >> > +++ b/drivers/gpio/gpio-omap.c
> >> > @@ -800,9 +800,7 @@ static struct platform_device omap_mpuio_device = {
> >> >  static inline void omap_mpuio_init(struct gpio_bank *bank)
> >> >  {
> >> >  	platform_set_drvdata(&omap_mpuio_device, bank);
> >> > -
> >> > -	if (platform_driver_register(&omap_mpuio_driver) == 0)
> >> > -		(void) platform_device_register(&omap_mpuio_device);
> >> > +	(void)platform_device_register(&omap_mpuio_device);
> >> >  }
> >> 
> >> On a second look, it recognize that this did abuse the fact that
> >> platform_driver_register() fails when attempting to register a driver multiple
> >> times to avoid registering the same static device multiple times.
> >> 
> >> So, I guess this has to be changed to:
> >> 
> >> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> >> index 8db71a2db9ff..3e1ac34994fb 100644
> >> --- a/drivers/gpio/gpio-omap.c
> >> +++ b/drivers/gpio/gpio-omap.c
> >> @@ -799,8 +799,13 @@ static struct platform_device omap_mpuio_device = {
> >> 
> >>  static inline void omap_mpuio_init(struct gpio_bank *bank)
> >>  {
> >> +       static bool registered = false;
> >> +
> >>         platform_set_drvdata(&omap_mpuio_device, bank);
> >> -       (void)platform_device_register(&omap_mpuio_device);
> >> +       if (!registered) {
> >> +               (void)platform_device_register(&omap_mpuio_device);
> >> +               registered = true;
> >> +       }
> >>  }
> >
> > But there are no platform resources for this at all, shouldn't this be a
> > faux device instead?
> 
> Probably, but that's for another patch, since this one may potentially be
> backported beyond the existence of the faux bus.
> 
> > That being said, ignoring the return value of platform_device_register()
> > is probably not something we want to keep around.
> 
> Yes, as mentioned below the commit message, there are a couple of things that
> need to be followed up on here.
> 
> With this patch I only intend to fix the deadlock condition and otherwise keep
> all the existing semantics as it is.
> 
> I.e. maybe it is intentional and this driver should not abort probing if this
> can't be registered for some reason.

Ok, fair enough, fixing this immediate bug is good enough for me.

Reviewed-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ