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: <2025022041-onyx-regular-d901@gregkh>
Date: Thu, 20 Feb 2025 13:11:17 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Thadeu Lima de Souza Cascardo <cascardo@...lia.com>
Cc: linux-kernel@...r.kernel.org, Arnd Bergmann <arnd@...db.de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Dirk VanDerMerwe <dirk.vandermerwe@...hos.com>,
	Vimal Agrawal <vimal.agrawal@...hos.com>, kernel-dev@...lia.com,
	stable@...r.kernel.org
Subject: Re: [PATCH 4/4] char: misc: deallocate static minor in error path

On Thu, Jan 23, 2025 at 09:32:49AM -0300, Thadeu Lima de Souza Cascardo wrote:
> When creating sysfs files fail, the allocated minor must be freed such that
> it can be later reused. That is specially harmful for static minor numbers,
> since those would always fail to register later on.
> 
> Fixes: 6d04d2b554b1 ("misc: misc_minor_alloc to use ida for all dynamic/misc dynamic minors")
> Cc: stable@...r.kernel.org
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@...lia.com>
> ---
>  drivers/char/misc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/misc.c b/drivers/char/misc.c
> index 7a768775e558..7843a1a34d64 100644
> --- a/drivers/char/misc.c
> +++ b/drivers/char/misc.c
> @@ -266,8 +266,8 @@ int misc_register(struct miscdevice *misc)
>  		device_create_with_groups(&misc_class, misc->parent, dev,
>  					  misc, misc->groups, "%s", misc->name);
>  	if (IS_ERR(misc->this_device)) {
> +		misc_minor_free(misc->minor);
>  		if (is_dynamic) {
> -			misc_minor_free(misc->minor);
>  			misc->minor = MISC_DYNAMIC_MINOR;
>  		}
>  		err = PTR_ERR(misc->this_device);
> -- 
> 2.34.1
> 
> 

Having a "fix" as patch 4/4 of a series is a pain, it should go to Linus
now, not for the next merge window, right?  I'll split this apart by
hand, but ugh, please be more careful next time.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ