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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210528101057.GH2209@amd>
Date:   Fri, 28 May 2021 12:10:57 +0200
From:   Pavel Machek <pavel@....cz>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Amireddy Mallikarjuna reddy 
        <mallikarjunax.reddy@...ux.intel.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Marek BehĂșn <marek.behun@....cz>,
        Abanoub Sameh <abanoubsameh8@...il.com>,
        Dan Murphy <dmurphy@...com>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 21/28] leds: lm3697: Make error handling more robust

On Mon 2021-05-10 12:50:38, Andy Shevchenko wrote:
> It's easy to miss necessary clean up, e.g. firmware node reference counting,
> during error path in ->probe(). Make it more robust by moving to a single
> point of return.
> 
> Signed-off-by: Andy Shevchenko <andy.shevchenko@...il.com>

You are now putting the handle even in the success case. Is that
right?
								Pavel

> ---
>  drivers/leds/leds-lm3697.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/leds/leds-lm3697.c b/drivers/leds/leds-lm3697.c
> index 9d35dd2a9bf0..6262ae69591e 100644
> --- a/drivers/leds/leds-lm3697.c
> +++ b/drivers/leds/leds-lm3697.c
> @@ -224,14 +224,12 @@ static int lm3697_probe_dt(struct lm3697 *priv)
>  		ret = fwnode_property_read_u32(child, "reg", &control_bank);
>  		if (ret) {
>  			dev_err(dev, "reg property missing\n");
> -			fwnode_handle_put(child);
>  			goto child_out;
>  		}
>  
>  		if (control_bank > LM3697_CONTROL_B) {
>  			dev_err(dev, "reg property is invalid\n");
>  			ret = -EINVAL;
> -			fwnode_handle_put(child);
>  			goto child_out;
>  		}
>  
> @@ -262,7 +260,6 @@ static int lm3697_probe_dt(struct lm3697 *priv)
>  						    led->num_leds);
>  		if (ret) {
>  			dev_err(dev, "led-sources property missing\n");
> -			fwnode_handle_put(child);
>  			goto child_out;
>  		}
>  
> @@ -287,7 +284,6 @@ static int lm3697_probe_dt(struct lm3697 *priv)
>  						     &init_data);
>  		if (ret) {
>  			dev_err(dev, "led register err: %d\n", ret);
> -			fwnode_handle_put(child);
>  			goto child_out;
>  		}
>  
> @@ -295,6 +291,7 @@ static int lm3697_probe_dt(struct lm3697 *priv)
>  	}
>  
>  child_out:
> +	fwnode_handle_put(child);
>  	return ret;
>  }
>  

-- 
http://www.livejournal.com/~pavelmachek

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ