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] [day] [month] [year] [list]
Message-ID: <20230921120546.GI3449785@google.com>
Date:   Thu, 21 Sep 2023 13:05:46 +0100
From:   Lee Jones <lee@...nel.org>
To:     Chunyan Zhang <chunyan.zhang@...soc.com>
Cc:     Pavel Machek <pavel@....cz>, linux-leds@...r.kernel.org,
        Baolin Wang <baolin.wang@...ux.alibaba.com>,
        Orson Zhai <orsonzhai@...il.com>,
        Chunyan Zhang <zhang.lyra@...il.com>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] leds: sc27xx: Add a missing mutex_destory()

On Thu, 21 Sep 2023, Chunyan Zhang wrote:

> In sc27xx_led_probe() there's one error branch missing mutex_destory()
> after mutex_init(), it seems that we should add it since other branches
> which follow it called mutex_destoy() before return failure.

Wouldn't it be better to move the mutex_init() to the end of .probe()?

> Fixes: e081c49e30ec ("leds: Add Spreadtrum SC27xx breathing light controller driver")
> Signed-off-by: Chunyan Zhang <chunyan.zhang@...soc.com>
> ---
>  drivers/leds/leds-sc27xx-bltc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/leds/leds-sc27xx-bltc.c b/drivers/leds/leds-sc27xx-bltc.c
> index e199ea15e406..122094bbf444 100644
> --- a/drivers/leds/leds-sc27xx-bltc.c
> +++ b/drivers/leds/leds-sc27xx-bltc.c
> @@ -300,6 +300,7 @@ static int sc27xx_led_probe(struct platform_device *pdev)
>  	priv->base = base;
>  	priv->regmap = dev_get_regmap(dev->parent, NULL);
>  	if (!priv->regmap) {
> +		mutex_destroy(&priv->lock);
>  		err = -ENODEV;
>  		dev_err(dev, "failed to get regmap: %d\n", err);
>  		return err;
> -- 
> 2.41.0
> 

-- 
Lee Jones [李琼斯]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ