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] [day] [month] [year] [list]
Date:   Mon, 18 Nov 2019 09:13:41 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     patrick.rudolph@...ements.com
Cc:     linux-kernel@...r.kernel.org, Arthur Heymans <arthur@...ymans.xyz>,
        Allison Randal <allison@...utok.net>,
        Thomas Gleixner <tglx@...utronix.de>,
        Alexios Zavras <alexios.zavras@...el.com>, furquan@...omium.org
Subject: Re: [PATCH 2/3] firmware: google: Unregister driver_info on failure
 and exit in gsmi

On Mon, Nov 18, 2019 at 08:59:32AM +0100, patrick.rudolph@...ements.com wrote:
> On Sat, 2019-11-16 at 14:40 +0100, Greg Kroah-Hartman wrote:
> > On Fri, Nov 15, 2019 at 02:48:38PM +0100, 
> > patrick.rudolph@...ements.com wrote:
> > > From: Arthur Heymans <arthur@...ymans.xyz>
> > > 
> > > Fix a bug where the kernel module couldn't be loaded after
> > > unloading,
> > > as the platform driver wasn't released on exit.
> > > 
> > > Signed-off-by: Arthur Heymans <arthur@...ymans.xyz>
> > > ---
> > >  drivers/firmware/google/gsmi.c | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > > 
> > > diff --git a/drivers/firmware/google/gsmi.c
> > > b/drivers/firmware/google/gsmi.c
> > > index edaa4e5d84ad..974c769b75cf 100644
> > > --- a/drivers/firmware/google/gsmi.c
> > > +++ b/drivers/firmware/google/gsmi.c
> > > @@ -1016,6 +1016,9 @@ static __init int gsmi_init(void)
> > >  	dma_pool_destroy(gsmi_dev.dma_pool);
> > >  	platform_device_unregister(gsmi_dev.pdev);
> > >  	pr_info("gsmi: failed to load: %d\n", ret);
> > > +#ifdef CONFIG_PM
> > > +	platform_driver_unregister(&gsmi_driver_info);
> > > +#endif
> > >  	return ret;
> > >  }
> > >  
> > > @@ -1037,6 +1040,9 @@ static void __exit gsmi_exit(void)
> > >  	gsmi_buf_free(gsmi_dev.name_buf);
> > >  	dma_pool_destroy(gsmi_dev.dma_pool);
> > >  	platform_device_unregister(gsmi_dev.pdev);
> > > +#ifdef CONFIG_PM
> > > +	platform_driver_unregister(&gsmi_driver_info);
> > 
> > Why the #ifdef here?  Why does PM change things?
> > 
> The driver is only registered if CONFIG_PM is selected, thus it only
> needs to be unregistered if CONFIG_PM is selected.
> 
> See 8942b2d5094b0 for reference.

That is a "fun" abuse of the platform driver interface :(

Why not just have this registration of your device for the "normal"
device your driver binds to?  Why create a special platform device
instead?  That means you have double the number of "devices" for your
single real device.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ