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]
Date: Tue, 4 Jun 2024 19:33:31 +0300
From: Andy Shevchenko <andy@...nel.org>
To: Markus Elfring <Markus.Elfring@....de>
Cc: kernel-janitors@...r.kernel.org,
	Geert Uytterhoeven <geert@...ux-m68k.org>,
	Marek Behún <kabel@...nel.org>,
	Miguel Ojeda <ojeda@...nel.org>,
	Robin van der Gracht <robin@...tonic.nl>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] auxdisplay: ht16k33: Drop device node reference after
 registration failure in ht16k33_led_probe()

On Tue, Jun 04, 2024 at 05:15:37PM +0200, Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Tue, 4 Jun 2024 17:02:15 +0200
> 
> A failed call of the function “devm_led_classdev_register_ext”
> can be reported.
> Add a call of the function “fwnode_handle_put” for this error case.

Replace double quotes by parentheses, so the reference to the functions
will look like func().

...

>  	err = devm_led_classdev_register_ext(dev, led, &init_data);
> -	if (err)
> +	if (err) {
>  		dev_err(dev, "Failed to register LED\n");
> +		fwnode_handle_put(init_data.fwnode);
> +	}

There are two issues with this approach:
1) there is the same issue in ->remove(), isn't it?
2) it potentially might mess up the ordering if any other devm call happens
   in beetween.

But, by design we don't use reference counting after we registered LED, hence
both error and successful paths need to have this, so add another
fwnode_handle_put() after this branch.

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ