]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
soc: ti: pruss: Fix double free in pruss_clk_mux_setup()
authorWentao Liang <vulab@iscas.ac.cn>
Tue, 13 Jan 2026 01:47:16 +0000 (01:47 +0000)
committerNishanth Menon <nm@ti.com>
Wed, 14 Jan 2026 17:00:07 +0000 (11:00 -0600)
In the pruss_clk_mux_setup(), the devm_add_action_or_reset() indirectly
calls pruss_of_free_clk_provider(), which calls of_node_put(clk_mux_np)
on the error path. However, after the devm_add_action_or_reset()
returns, the of_node_put(clk_mux_np) is called again, causing a double
free.

Fix by returning directly, to avoid the duplicate of_node_put().

Fixes: ba59c9b43c86 ("soc: ti: pruss: support CORECLK_MUX and IEPCLK_MUX")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Link: https://patch.msgid.link/20260113014716.2464741-1-vulab@iscas.ac.cn
Signed-off-by: Nishanth Menon <nm@ti.com>
drivers/soc/ti/pruss.c

index 038576805bfa0f8dece569cf6faecedfb43a392f..0fd59c73f585d2a2cb81ff7834dc046c913d660e 100644 (file)
@@ -366,12 +366,10 @@ static int pruss_clk_mux_setup(struct pruss *pruss, struct clk *clk_mux,
 
        ret = devm_add_action_or_reset(dev, pruss_of_free_clk_provider,
                                       clk_mux_np);
-       if (ret) {
+       if (ret)
                dev_err(dev, "failed to add clkmux free action %d", ret);
-               goto put_clk_mux_np;
-       }
 
-       return 0;
+       return ret;
 
 put_clk_mux_np:
        of_node_put(clk_mux_np);