All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: Fix memory leak in devm_clk_notifier_register()
@ 2023-06-17  8:09 Fei Shao
  2023-06-17 20:00 ` [cocci] " Markus Elfring
  0 siblings, 1 reply; 9+ 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] 9+ messages in thread

* Re: [cocci] [PATCH] clk: Fix memory leak in devm_clk_notifier_register()
  2023-06-17  8:09 [PATCH] clk: Fix memory leak in devm_clk_notifier_register() Fei Shao
@ 2023-06-17 20:00 ` Markus Elfring
  2023-06-19  3:56   ` Fei Shao
  0 siblings, 1 reply; 9+ messages in thread
From: Markus Elfring @ 2023-06-17 20:00 UTC (permalink / raw)
  To: Fei Shao, Jerome Brunet, Michael Turquette, Stephen Boyd,
	linux-clk, kernel-janitors
  Cc: LKML, cocci

> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] clk: Fix memory leak in devm_clk_notifier_register()
  2023-06-17 20:00 ` [cocci] " Markus Elfring
@ 2023-06-19  3:56   ` Fei Shao
  2023-06-19  5:27     ` Dan Carpenter
  0 siblings, 1 reply; 9+ 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] 9+ 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
  2023-06-19  7:42       ` [cocci] " Markus Elfring
  0 siblings, 1 reply; 9+ 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] 9+ messages in thread

* Re: [cocci] clk: Fix memory leak in devm_clk_notifier_register()
  2023-06-19  5:27     ` Dan Carpenter
@ 2023-06-19  7:42       ` Markus Elfring
  2023-06-19  8:32         ` Dan Carpenter
  0 siblings, 1 reply; 9+ messages in thread
From: Markus Elfring @ 2023-06-19  7:42 UTC (permalink / raw)
  To: Dan Carpenter, Fei Shao, Jerome Brunet, Michael Turquette,
	Stephen Boyd, linux-clk, kernel-janitors
  Cc: LKML, cocci, Linus Walleij

>>>> 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
>>
>> Thanks for the feedback. I just sent v2.
>
> Markus is banned from vger lists...

I hope that such a communication system configuration can be reconsidered.


> 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?

Regards,
Markus

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: clk: Fix memory leak in devm_clk_notifier_register()
  2023-06-19  7:42       ` [cocci] " Markus Elfring
@ 2023-06-19  8:32         ` Dan Carpenter
  2023-06-19  9:11           ` [cocci] " Markus Elfring
  0 siblings, 1 reply; 9+ 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] 9+ messages in thread

* Re: [cocci] clk: Fix memory leak in devm_clk_notifier_register()
  2023-06-19  8:32         ` Dan Carpenter
@ 2023-06-19  9:11           ` Markus Elfring
  2023-06-19  9:30             ` Dan Carpenter
  0 siblings, 1 reply; 9+ messages in thread
From: Markus Elfring @ 2023-06-19  9:11 UTC (permalink / raw)
  To: Dan Carpenter, Fei Shao, Jerome Brunet, Linus Walleij,
	Michael Turquette, Stephen Boyd, linux-clk, kernel-janitors
  Cc: LKML, cocci

>> 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.

I find it interesting how views are varying also according patch review approaches.


> You're just creating noise when we should be looking at if the patch is correct

How much do change descriptions matter for the desired correctness check?

Another example for a subsequent version:
[PATCH v2] clk: Fix memory leak in devm_clk_notifier_register()
https://lore.kernel.org/linux-clk/20230619112253.v2.1.I13f060c10549ef181603e921291bdea95f83033c@changeid/
https://lkml.org/lkml/2023/6/18/326


> and how we can improve our QC infrastructure to prevent bugs like this in the future.

Would you like to add any more ideas for this area?

Regards,
Markus

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: clk: Fix memory leak in devm_clk_notifier_register()
  2023-06-19  9:11           ` [cocci] " Markus Elfring
@ 2023-06-19  9:30             ` Dan Carpenter
  2023-06-19  9:57               ` [cocci] " Markus Elfring
  0 siblings, 1 reply; 9+ 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] 9+ messages in thread

* Re: [cocci] clk: Fix memory leak in devm_clk_notifier_register()
  2023-06-19  9:30             ` Dan Carpenter
@ 2023-06-19  9:57               ` Markus Elfring
  0 siblings, 0 replies; 9+ messages in thread
From: Markus Elfring @ 2023-06-19  9:57 UTC (permalink / raw)
  To: Dan Carpenter, kernel-janitors
  Cc: Fei Shao, Jerome Brunet, Linus Walleij, Michael Turquette,
	Stephen Boyd, linux-clk, LKML, cocci

> Markus you always answer every email with more questions instead of
> just listening to what I am saying.

Additional input triggers further clarification opportunities.


> This is why you were banned.

I guess that various factors were involved for this historic action.


> 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.

Thanks for another bit of positive feedback.


> If they are about coding style or grammar then they are distracting.

Such items belong also to patch review approaches.


> I know that you are going to ask more questions

Some developers and code reviewers are used to such a habit.


> but I am not going to respond further.

Constructive responses can evolve also according to various change possibilities
(which are still in waiting queues).

Regards,
Markus

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-06-19  9:57 UTC | newest]

Thread overview: 9+ 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
2023-06-17 20:00 ` [cocci] " Markus Elfring
2023-06-19  3:56   ` Fei Shao
2023-06-19  5:27     ` Dan Carpenter
2023-06-19  7:42       ` [cocci] " Markus Elfring
2023-06-19  8:32         ` Dan Carpenter
2023-06-19  9:11           ` [cocci] " Markus Elfring
2023-06-19  9:30             ` Dan Carpenter
2023-06-19  9:57               ` [cocci] " Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.