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: <YnuyuFRaDTY2n4VB@kroah.com>
Date:   Wed, 11 May 2022 14:57:28 +0200
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Schspa Shi <schspa@...il.com>
Cc:     rafael@...nel.org, ming.lei@...onical.com,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] driver: base: fix UAF when driver_attach failed

On Wed, May 11, 2022 at 08:43:36PM +0800, Schspa Shi wrote:
> When driver_attach(drv); failed, the driver_private will be freed.
> But it has been added to the bus, which caused a UAF.
> 
> To fix it, we need to delete it from the bus when failed.
> 
> Fixes: 190888ac01d0 ("driver core: fix possible missing of device probe")
> 
> Signed-off-by: Schspa Shi <schspa@...il.com>

No blank line needed after fixes:

> ---
>  drivers/base/bus.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/base/bus.c b/drivers/base/bus.c
> index 97936ec49bde..7ca47e5b3c1f 100644
> --- a/drivers/base/bus.c
> +++ b/drivers/base/bus.c
> @@ -617,7 +617,7 @@ int bus_add_driver(struct device_driver *drv)
>  	if (drv->bus->p->drivers_autoprobe) {
>  		error = driver_attach(drv);
>  		if (error)
> -			goto out_unregister;
> +			goto out_del_list;
>  	}
>  	module_add_driver(drv->owner, drv);
>  
> @@ -644,6 +644,8 @@ int bus_add_driver(struct device_driver *drv)
>  
>  	return 0;
>  
> +out_del_list:
> +	klist_del(&priv->knode_bus);

Odd, how did you find this?  Has this ever been triggered by any
real-world situations?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ