PM / devfreq: Fix leak in devfreq_dev_release()
authorBoris Brezillon <boris.brezillon@collabora.com>
Wed, 9 Aug 2023 11:31:08 +0000 (13:31 +0200)
committerChanwoo Choi <cw00.choi@samsung.com>
Thu, 10 Aug 2023 13:48:16 +0000 (22:48 +0900)
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>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
drivers/devfreq/devfreq.c

index db50c93c0ac387669e9ac52a4fcf715f86dc44ee..474d81831ad36b153b145178937467f3dae0a038 100644 (file)
@@ -764,6 +764,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);
 }