* [PATCH next] pinctrl: keembay: fix double free in keembay_build_functions()
@ 2025-09-04 18:58 Dan Carpenter
2025-09-04 19:08 ` Bartosz Golaszewski
2025-09-04 19:37 ` Linus Walleij
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2025-09-04 18:58 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Linus Walleij, linux-gpio, linux-kernel, kernel-janitors
This kfree() was accidentally left over when we converted to devm_
and it would lead to a double free. Delete it.
Fixes: 995bc9f4826e ("pinctrl: keembay: release allocated memory in detach path")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/pinctrl/pinctrl-keembay.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-keembay.c b/drivers/pinctrl/pinctrl-keembay.c
index 30122ca90cbe..3241d3ae6219 100644
--- a/drivers/pinctrl/pinctrl-keembay.c
+++ b/drivers/pinctrl/pinctrl-keembay.c
@@ -1643,10 +1643,8 @@ static int keembay_build_functions(struct keembay_pinctrl *kpc)
new_funcs = devm_krealloc_array(kpc->dev, keembay_funcs,
kpc->nfuncs, sizeof(*new_funcs),
GFP_KERNEL);
- if (!new_funcs) {
- kfree(keembay_funcs);
+ if (!new_funcs)
return -ENOMEM;
- }
return keembay_add_functions(kpc, new_funcs);
}
--
2.47.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH next] pinctrl: keembay: fix double free in keembay_build_functions()
2025-09-04 18:58 [PATCH next] pinctrl: keembay: fix double free in keembay_build_functions() Dan Carpenter
@ 2025-09-04 19:08 ` Bartosz Golaszewski
2025-09-04 19:37 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2025-09-04 19:08 UTC (permalink / raw)
To: Dan Carpenter
Cc: Linus Walleij, linux-gpio, linux-kernel, kernel-janitors,
Bartosz Golaszewski
On Thu, 4 Sep 2025 20:58:54 +0200, Dan Carpenter
<dan.carpenter@linaro.org> said:
> This kfree() was accidentally left over when we converted to devm_
> and it would lead to a double free. Delete it.
>
> Fixes: 995bc9f4826e ("pinctrl: keembay: release allocated memory in detach path")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/pinctrl/pinctrl-keembay.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-keembay.c b/drivers/pinctrl/pinctrl-keembay.c
> index 30122ca90cbe..3241d3ae6219 100644
> --- a/drivers/pinctrl/pinctrl-keembay.c
> +++ b/drivers/pinctrl/pinctrl-keembay.c
> @@ -1643,10 +1643,8 @@ static int keembay_build_functions(struct keembay_pinctrl *kpc)
> new_funcs = devm_krealloc_array(kpc->dev, keembay_funcs,
> kpc->nfuncs, sizeof(*new_funcs),
> GFP_KERNEL);
> - if (!new_funcs) {
> - kfree(keembay_funcs);
> + if (!new_funcs)
> return -ENOMEM;
> - }
>
> return keembay_add_functions(kpc, new_funcs);
> }
> --
> 2.47.2
>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH next] pinctrl: keembay: fix double free in keembay_build_functions()
2025-09-04 18:58 [PATCH next] pinctrl: keembay: fix double free in keembay_build_functions() Dan Carpenter
2025-09-04 19:08 ` Bartosz Golaszewski
@ 2025-09-04 19:37 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2025-09-04 19:37 UTC (permalink / raw)
To: Dan Carpenter
Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, kernel-janitors
On Thu, Sep 4, 2025 at 8:58 PM Dan Carpenter <dan.carpenter@linaro.org> wrote:
> This kfree() was accidentally left over when we converted to devm_
> and it would lead to a double free. Delete it.
>
> Fixes: 995bc9f4826e ("pinctrl: keembay: release allocated memory in detach path")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Patch applied!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-04 19:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-04 18:58 [PATCH next] pinctrl: keembay: fix double free in keembay_build_functions() Dan Carpenter
2025-09-04 19:08 ` Bartosz Golaszewski
2025-09-04 19:37 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox