* [PATCH] pinctrl: core: fix pin name leak on radix_tree_insert() error path
@ 2026-10-09 5:45 Haotian Zhang
2026-10-09 6:06 ` Krzysztof Kozlowski
2026-10-09 15:58 ` Sergey Shtylyov
0 siblings, 2 replies; 3+ messages in thread
From: Haotian Zhang @ 2026-10-09 5:45 UTC (permalink / raw)
To: Linus Walleij, Sergey Shtylyov; +Cc: linux-gpio, linux-kernel
pinctrl_register_one_pin() allocates pindesc->name with kasprintf() when
the pin has no static name, and marks it with pindesc->dynamic_name. If
the subsequent radix_tree_insert() fails, the function jumps to the
failed label, which only calls kfree(pindesc) and never frees the
dynamically allocated name, leaking it.
Since the insertion failed, the pin is not in the radix tree, so the
caller's pinctrl_free_pindescs() cleanup cannot find it and cannot
release the name either.
Release pindesc->name on the failed path when it was dynamically
allocated.
Fixes: ecfe9a015d3e ("pinctrl: core: handle radix_tree_insert() errors in pinctrl_register_one_pin()")
Assisted-by: DeepSeek-V4.1-Flash
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
drivers/pinctrl/core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 1675dd36bd5c..3a1d1ff871ef 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -249,6 +249,8 @@ static int pinctrl_register_one_pin(struct pinctrl_dev *pctldev,
return 0;
failed:
+ if (pindesc->dynamic_name)
+ kfree(pindesc->name);
kfree(pindesc);
return error;
}
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pinctrl: core: fix pin name leak on radix_tree_insert() error path
2026-10-09 5:45 [PATCH] pinctrl: core: fix pin name leak on radix_tree_insert() error path Haotian Zhang
@ 2026-10-09 6:06 ` Krzysztof Kozlowski
2026-10-09 15:58 ` Sergey Shtylyov
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2026-10-09 6:06 UTC (permalink / raw)
To: Haotian Zhang; +Cc: linux-kernel, Sergey Shtylyov, Linus Walleij, linux-gpio
On Fri, 09 Oct 2026 13:45:56 +0800, Haotian Zhang wrote:
> pinctrl_register_one_pin() allocates pindesc->name with kasprintf() when
> the pin has no static name, and marks it with pindesc->dynamic_name. If
> the subsequent radix_tree_insert() fails, the function jumps to the
> failed label, which only calls kfree(pindesc) and never frees the
> dynamically allocated name, leaking it.
>
> Since the insertion failed, the pin is not in the radix tree, so the
> caller's pinctrl_free_pindescs() cleanup cannot find it and cannot
> release the name either.
>
> Release pindesc->name on the failed path when it was dynamically
> allocated.
>
> Fixes: ecfe9a015d3e ("pinctrl: core: handle radix_tree_insert() errors in pinctrl_register_one_pin()")
> Assisted-by: DeepSeek-V4.1-Flash
> Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
> ---
> drivers/pinctrl/core.c | 2 ++
> 1 file changed, 2 insertions(+)
>
Multiple things here:
1. Your team ignored completely previous feedback.
2. You use multiple identities with this email, thus I actually doubt we speak
with actual person.
3. Finally, same feedback:
You sent multiple independent patches, to multiple independent
subsystems. The amount of these patches clearly suggest this was
AI generated and most likely not tested.
More importantly, you sent all this work without properly organizing
relevant patches into patchsets. This makes reviewing difficult
and might cause multiple reviewers to address the same issue.
Replying to the entire set is impossible and requires handling each
patch independently, instead of applying or discarding the set.
Maintainers also won't see the bigger picture of your work. Quite
worrying.
This is on the verge of hostile patch: bomb us with so many
contributions, we won't be able to handle them in efficient manner,
like responding ONCE to ask you to slow down. Considering all this
is untested and LLM generated, I have even more doubts whether this
should be considered for review.
Please read kernel documentation BEFORE posting more work. It will
explain you how to identify subsystems, how to organize your work per
subsystem (so a patchset grouping multiple patches with a short cover
letter), how to document usage of LLM and how what you should not do
if this was posted in a good faith.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pinctrl: core: fix pin name leak on radix_tree_insert() error path
2026-10-09 5:45 [PATCH] pinctrl: core: fix pin name leak on radix_tree_insert() error path Haotian Zhang
2026-10-09 6:06 ` Krzysztof Kozlowski
@ 2026-10-09 15:58 ` Sergey Shtylyov
1 sibling, 0 replies; 3+ messages in thread
From: Sergey Shtylyov @ 2026-10-09 15:58 UTC (permalink / raw)
To: Haotian Zhang, Linus Walleij; +Cc: linux-gpio, linux-kernel
On 10/9/26 8:45 AM, Haotian Zhang wrote:
> pinctrl_register_one_pin() allocates pindesc->name with kasprintf() when
> the pin has no static name, and marks it with pindesc->dynamic_name. If
> the subsequent radix_tree_insert() fails, the function jumps to the
> failed label, which only calls kfree(pindesc) and never frees the
> dynamically allocated name, leaking it.
>
> Since the insertion failed, the pin is not in the radix tree, so the
> caller's pinctrl_free_pindescs() cleanup cannot find it and cannot
> release the name either.
>
> Release pindesc->name on the failed path when it was dynamically
> allocated.
>
> Fixes: ecfe9a015d3e ("pinctrl: core: handle radix_tree_insert() errors in pinctrl_register_one_pin()")
> Assisted-by: DeepSeek-V4.1-Flash
> Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Oops, my fault indeed! :-( If you want, you can add my:
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
[...]
> diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
> index 1675dd36bd5c..3a1d1ff871ef 100644
> --- a/drivers/pinctrl/core.c
> +++ b/drivers/pinctrl/core.c
> @@ -249,6 +249,8 @@ static int pinctrl_register_one_pin(struct pinctrl_dev *pctldev,
> return 0;
>
> failed:
> + if (pindesc->dynamic_name)
> + kfree(pindesc->name);
You may as well add another label here -- for the 1st *goto*...
> kfree(pindesc);
> return error;
> }
[...]
MBR, Sergey
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-09 15:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-09 5:45 [PATCH] pinctrl: core: fix pin name leak on radix_tree_insert() error path Haotian Zhang
2026-10-09 6:06 ` Krzysztof Kozlowski
2026-10-09 15:58 ` Sergey Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®