]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
clk: Fix pointer casting to prevent oops in devm_clk_release()
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Mon, 20 Jun 2022 17:18:15 +0000 (19:18 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 14 Dec 2022 13:02:55 +0000 (14:02 +0100)
[ Upstream commit 8b3d743fc9e2542822826890b482afabf0e7522a ]

The release function is called with a pointer to the memory returned by
devres_alloc(). I was confused about that by the code before the
generalization that used a struct clk **ptr.

Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Fixes: abae8e57e49a ("clk: generalize devm_clk_get() a bit")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220620171815.114212-1-u.kleine-koenig@pengutronix.de
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 3b714f25fc591641b92865b85933993c19923e47)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
drivers/clk/clk-devres.c

index 43ccd20e02988080e4c10d1bcc6f4297914f25dd..4fb4fd4b06bdade6729ef0f15f861bc0cd262930 100644 (file)
@@ -11,7 +11,7 @@ struct devm_clk_state {
 
 static void devm_clk_release(struct device *dev, void *res)
 {
-       struct devm_clk_state *state = *(struct devm_clk_state **)res;
+       struct devm_clk_state *state = res;
 
        if (state->exit)
                state->exit(state->clk);