* [PATCH] PM / devfreq: Fix leak in devfreq_dev_release()
@ 2023-08-09 11:31 Boris Brezillon
2023-08-10 5:21 ` Dhruva Gole
2023-08-10 13:50 ` Chanwoo Choi
0 siblings, 2 replies; 4+ messages in thread
From: Boris Brezillon @ 2023-08-09 11:31 UTC (permalink / raw)
To: MyungJoo Ham, Kyungmin Park, Chanwoo Choi, linux-pm
Cc: Boris Brezillon, stable
srcu_init_notifier_head() allocates resources that need to be released
with a srcu_cleanup_notifier_head() call.
Reported by kmemleak.
Fixes: 0fe3a66410a3 ("PM / devfreq: Add new DEVFREQ_TRANSITION_NOTIFIER notifier")
Cc: <stable@vger.kernel.org>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
drivers/devfreq/devfreq.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index e36cbb920ec8..9464f8d3cb5b 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -763,6 +763,7 @@ static void devfreq_dev_release(struct device *dev)
dev_pm_opp_put_opp_table(devfreq->opp_table);
mutex_destroy(&devfreq->lock);
+ srcu_cleanup_notifier_head(&devfreq->transition_notifier_list);
kfree(devfreq);
}
--
2.41.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] PM / devfreq: Fix leak in devfreq_dev_release()
2023-08-09 11:31 [PATCH] PM / devfreq: Fix leak in devfreq_dev_release() Boris Brezillon
@ 2023-08-10 5:21 ` Dhruva Gole
2023-08-10 6:49 ` Boris Brezillon
2023-08-10 13:50 ` Chanwoo Choi
1 sibling, 1 reply; 4+ messages in thread
From: Dhruva Gole @ 2023-08-10 5:21 UTC (permalink / raw)
To: Boris Brezillon
Cc: MyungJoo Ham, Kyungmin Park, Chanwoo Choi, linux-pm, stable
On Aug 09, 2023 at 13:31:08 +0200, Boris Brezillon wrote:
> srcu_init_notifier_head() allocates resources that need to be released
> with a srcu_cleanup_notifier_head() call.
>
> Reported by kmemleak.
Probably want to give a proper mention like:
Reported-by: Name <email-id>
?
>
> Fixes: 0fe3a66410a3 ("PM / devfreq: Add new DEVFREQ_TRANSITION_NOTIFIER notifier")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
> drivers/devfreq/devfreq.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index e36cbb920ec8..9464f8d3cb5b 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -763,6 +763,7 @@ static void devfreq_dev_release(struct device *dev)
> dev_pm_opp_put_opp_table(devfreq->opp_table);
>
> mutex_destroy(&devfreq->lock);
> + srcu_cleanup_notifier_head(&devfreq->transition_notifier_list);
Good catch!
Reviewed-by: Dhruva Gole <d-gole@ti.com>
> kfree(devfreq);
> }
>
> --
> 2.41.0
>
--
Best regards,
Dhruva Gole <d-gole@ti.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PM / devfreq: Fix leak in devfreq_dev_release()
2023-08-10 5:21 ` Dhruva Gole
@ 2023-08-10 6:49 ` Boris Brezillon
0 siblings, 0 replies; 4+ messages in thread
From: Boris Brezillon @ 2023-08-10 6:49 UTC (permalink / raw)
To: Dhruva Gole; +Cc: MyungJoo Ham, Kyungmin Park, Chanwoo Choi, linux-pm, stable
On Thu, 10 Aug 2023 10:51:09 +0530
Dhruva Gole <d-gole@ti.com> wrote:
> On Aug 09, 2023 at 13:31:08 +0200, Boris Brezillon wrote:
> > srcu_init_notifier_head() allocates resources that need to be released
> > with a srcu_cleanup_notifier_head() call.
> >
> > Reported by kmemleak.
>
> Probably want to give a proper mention like:
> Reported-by: Name <email-id>
> ?
Does kmemleak have a standard Reported-by tag? Otherwise, the reported
is me (ran kmemleak when developing a driver, and this showed up), and
since I'm also the one fixing the bug, I'm not sure it's worth
mentioning.
>
> >
> > Fixes: 0fe3a66410a3 ("PM / devfreq: Add new DEVFREQ_TRANSITION_NOTIFIER notifier")
> > Cc: <stable@vger.kernel.org>
> > Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> > ---
> > drivers/devfreq/devfreq.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> > index e36cbb920ec8..9464f8d3cb5b 100644
> > --- a/drivers/devfreq/devfreq.c
> > +++ b/drivers/devfreq/devfreq.c
> > @@ -763,6 +763,7 @@ static void devfreq_dev_release(struct device *dev)
> > dev_pm_opp_put_opp_table(devfreq->opp_table);
> >
> > mutex_destroy(&devfreq->lock);
> > + srcu_cleanup_notifier_head(&devfreq->transition_notifier_list);
>
> Good catch!
> Reviewed-by: Dhruva Gole <d-gole@ti.com>
>
> > kfree(devfreq);
> > }
> >
> > --
> > 2.41.0
> >
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PM / devfreq: Fix leak in devfreq_dev_release()
2023-08-09 11:31 [PATCH] PM / devfreq: Fix leak in devfreq_dev_release() Boris Brezillon
2023-08-10 5:21 ` Dhruva Gole
@ 2023-08-10 13:50 ` Chanwoo Choi
1 sibling, 0 replies; 4+ messages in thread
From: Chanwoo Choi @ 2023-08-10 13:50 UTC (permalink / raw)
To: Boris Brezillon, MyungJoo Ham, Kyungmin Park, Chanwoo Choi,
linux-pm; +Cc: stable
On 23. 8. 9. 20:31, Boris Brezillon wrote:
> srcu_init_notifier_head() allocates resources that need to be released
> with a srcu_cleanup_notifier_head() call.
>
> Reported by kmemleak.
>
> Fixes: 0fe3a66410a3 ("PM / devfreq: Add new DEVFREQ_TRANSITION_NOTIFIER notifier")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
> drivers/devfreq/devfreq.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index e36cbb920ec8..9464f8d3cb5b 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -763,6 +763,7 @@ static void devfreq_dev_release(struct device *dev)
> dev_pm_opp_put_opp_table(devfreq->opp_table);
>
> mutex_destroy(&devfreq->lock);
> + srcu_cleanup_notifier_head(&devfreq->transition_notifier_list);
> kfree(devfreq);
> }
>
Applied it. Thanks.
--
Best Regards,
Samsung Electronics
Chanwoo Choi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-10 13:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-09 11:31 [PATCH] PM / devfreq: Fix leak in devfreq_dev_release() Boris Brezillon
2023-08-10 5:21 ` Dhruva Gole
2023-08-10 6:49 ` Boris Brezillon
2023-08-10 13:50 ` Chanwoo Choi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox