]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Sep 2023 08:46:59 +0000 (10:46 +0200)
commit 5693d077595de721f9ddbf9d37f40e5409707dfe upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/devfreq/devfreq.c

index b05e6a15221c9dfc6ab65a84bf26761aeaa72b73..e6674448a0bc3ae69f223af9f40d7d9cb7e751ec 100644 (file)
@@ -495,6 +495,7 @@ static void devfreq_dev_release(struct device *dev)
                devfreq->profile->exit(devfreq->dev.parent);
 
        mutex_destroy(&devfreq->lock);
+       srcu_cleanup_notifier_head(&devfreq->transition_notifier_list);
        kfree(devfreq);
 }