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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yrm5U0wU7tJPhyp6@kroah.com>
Date:   Mon, 27 Jun 2022 16:06:11 +0200
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Zhi Song <zhi.song@...edance.com>
Cc:     vilhelm.gray@...il.com, rafael@...nel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] isa: put_device after failing to device_register

On Wed, Jun 15, 2022 at 11:15:58PM +0800, Zhi Song wrote:
> device_register() is used to register a device with the system.
> We need to call put_device() to give up the reference initialized
> in device_register() when it returns an error and this will clean
> up correctly.
> 
> Fixes: a5117ba7da37 ("Driver model: add ISA bus")
> Signed-off-by: Zhi Song <zhi.song@...edance.com>
> ---
> V1 -> V2: Fix up the changelog text correct.
> V2 -> V3: Add a fixes tag line specifying the commit where this bug was
> introduced.
> ---
>  drivers/base/isa.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/base/isa.c b/drivers/base/isa.c
> index 55e3ee2da98f..cf88f3d77b7d 100644
> --- a/drivers/base/isa.c
> +++ b/drivers/base/isa.c
> @@ -173,8 +173,10 @@ static int __init isa_bus_init(void)
>  	error = bus_register(&isa_bus_type);
>  	if (!error) {
>  		error = device_register(&isa_bus);
> -		if (error)
> +		if (error) {
> +			put_device(&isa_bus);

Did you test this change and notice the kernel log error that happens
when you run it?

If you can really reproduce this in a real-life situation, you need to
do more than just this change.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ