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: <1ecb3859ae79fee2031e8aae5380f509629eae93.camel@foss.st.com>
Date: Wed, 29 Oct 2025 10:30:44 +0100
From: Antonio Borneo <antonio.borneo@...s.st.com>
To: Haotian Zhang <vulab@...as.ac.cn>, <linus.walleij@...aro.org>
CC: <mcoquelin.stm32@...il.com>, <alexandre.torgue@...s.st.com>,
        <linux-gpio@...r.kernel.org>,
        <linux-stm32@...md-mailman.stormreply.com>,
        <linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] pinctrl: stm32: fix hwspinlock resource leak in probe
 function

On Wed, 2025-10-29 at 09:42 +0800, Haotian Zhang wrote:
> In stm32_pctl_probe(), hwspin_lock_request_specific() is called to
> request a hwspinlock, but the acquired lock is not freed on multiple
> error paths after this call. This causes resource leakage when the
> function fails to initialize properly.
> 
> Use devm_hwspin_lock_request_specific() instead of
> hwspin_lock_request_specific() to automatically manage the hwspinlock
> resource lifecycle.
> 
> Fixes: 97cfb6cd34f2 ("pinctrl: stm32: protect configuration registers with a hwspinlock")
> Signed-off-by: Haotian Zhang <vulab@...as.ac.cn>
> ---
>  drivers/pinctrl/stm32/pinctrl-stm32.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
> index 823c8fe758e2..d9a2d20a7e6b 100644
> --- a/drivers/pinctrl/stm32/pinctrl-stm32.c
> +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
> @@ -1671,7 +1671,7 @@ int stm32_pctl_probe(struct platform_device *pdev)
>                 if (hwlock_id == -EPROBE_DEFER)
>                         return hwlock_id;
>         } else {
> -               pctl->hwlock = hwspin_lock_request_specific(hwlock_id);
> +               pctl->hwlock = devm_hwspin_lock_request_specific(dev, hwlock_id);
>         }
>  
>         spin_lock_init(&pctl->irqmux_lock);

Reviewed-by: Antonio Borneo <antonio.borneo@...s.st.com>

Thanks!
Antonio

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ