* [PATCH] clk: Fix memory leak in devm_clk_notifier_register()
@ 2023-06-17 8:09 Fei Shao
[not found] ` <71168ceb-8273-4067-d0e0-c6c219d4618e@web.de>
0 siblings, 1 reply; 5+ messages in thread
From: Fei Shao @ 2023-06-17 8:09 UTC (permalink / raw)
To: Stephen Boyd
Cc: Fei Shao, Jerome Brunet, Michael Turquette, linux-clk,
linux-kernel
devm_clk_notifier_register() allocates a devres resource for clk
notifier but didn't register that to the device, so the notifier didn't
get unregistered on device detach and the allocated resource was leaked.
This fixes the issue.
Fixes: 6d30d50d037d ("clk: add devm variant of clk_notifier_register")
Signed-off-by: Fei Shao <fshao@chromium.org>
---
drivers/clk/clk.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 7ac9f7a8cb84..c249f9791ae8 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -4741,6 +4741,7 @@ int devm_clk_notifier_register(struct device *dev, struct clk *clk,
if (!ret) {
devres->clk = clk;
devres->nb = nb;
+ devres_add(dev, devres);
} else {
devres_free(devres);
}
--
2.41.0.162.gfafddb0af9-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] clk: Fix memory leak in devm_clk_notifier_register()
[not found] ` <71168ceb-8273-4067-d0e0-c6c219d4618e@web.de>
@ 2023-06-19 3:56 ` Fei Shao
2023-06-19 5:27 ` Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: Fei Shao @ 2023-06-19 3:56 UTC (permalink / raw)
To: Markus Elfring
Cc: Jerome Brunet, Michael Turquette, Stephen Boyd, linux-clk,
kernel-janitors, LKML, cocci
On Sun, Jun 18, 2023 at 4:06 AM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> > This fixes the issue.
>
> Please replace this sentence by an imperative change suggestion.
>
> See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.4-rc6#n94
>
> Regards,
> Markus
Thanks for the feedback. I just sent v2.
Regards,
Fei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] clk: Fix memory leak in devm_clk_notifier_register()
2023-06-19 3:56 ` Fei Shao
@ 2023-06-19 5:27 ` Dan Carpenter
[not found] ` <ea5c0b0b-7aa5-d4eb-def9-fa279d69cd44@web.de>
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2023-06-19 5:27 UTC (permalink / raw)
To: Fei Shao
Cc: Markus Elfring, Jerome Brunet, Michael Turquette, Stephen Boyd,
linux-clk, kernel-janitors, LKML, cocci
On Mon, Jun 19, 2023 at 11:56:56AM +0800, Fei Shao wrote:
> On Sun, Jun 18, 2023 at 4:06 AM Markus Elfring <Markus.Elfring@web.de> wrote:
> >
> > > This fixes the issue.
> >
> > Please replace this sentence by an imperative change suggestion.
> >
> > See also:
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.4-rc6#n94
> >
> > Regards,
> > Markus
>
> Thanks for the feedback. I just sent v2.
Markus is banned from vger lists... He doesn't have a very accurate
perspective of what is important and what is not important.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: clk: Fix memory leak in devm_clk_notifier_register()
[not found] ` <ea5c0b0b-7aa5-d4eb-def9-fa279d69cd44@web.de>
@ 2023-06-19 8:32 ` Dan Carpenter
[not found] ` <6e1071ec-f19a-454c-215a-b5193984bc6b@web.de>
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2023-06-19 8:32 UTC (permalink / raw)
To: Markus Elfring
Cc: Fei Shao, Jerome Brunet, Michael Turquette, Stephen Boyd,
linux-clk, kernel-janitors, LKML, cocci, Linus Walleij
On Mon, Jun 19, 2023 at 09:42:37AM +0200, Markus Elfring wrote:
> > He doesn't have a very accurate perspective
> > of what is important and what is not important.
>
> I offered various hints for desirable change possibilities.
> The change acceptance might evolve in more constructive ways, doesn't it?
No, I'm sorry, it's not constructive at all. You're just creating noise
when we should be looking at if the patch is correct and how we can
improve our QC infrastructure to prevent bugs like this in the future.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: clk: Fix memory leak in devm_clk_notifier_register()
[not found] ` <6e1071ec-f19a-454c-215a-b5193984bc6b@web.de>
@ 2023-06-19 9:30 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2023-06-19 9:30 UTC (permalink / raw)
To: Markus Elfring
Cc: Fei Shao, Jerome Brunet, Linus Walleij, Michael Turquette,
Stephen Boyd, linux-clk, kernel-janitors, LKML, cocci
Markus you always answer every email with more questions instead of
just listening to what I am saying. This is why you were banned.
Even though you are banned, I encourage people to merge your patches
if they fix bugs. And if your review comments are about bugs then they
are welcome. If they are about coding style or grammar then they are
distracting.
I know that you are going to ask more questions but I am not going to
respond further.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-06-19 9:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-17 8:09 [PATCH] clk: Fix memory leak in devm_clk_notifier_register() Fei Shao
[not found] ` <71168ceb-8273-4067-d0e0-c6c219d4618e@web.de>
2023-06-19 3:56 ` Fei Shao
2023-06-19 5:27 ` Dan Carpenter
[not found] ` <ea5c0b0b-7aa5-d4eb-def9-fa279d69cd44@web.de>
2023-06-19 8:32 ` Dan Carpenter
[not found] ` <6e1071ec-f19a-454c-215a-b5193984bc6b@web.de>
2023-06-19 9:30 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox