* [PATCH v2] soc: ti: pruss: fix double free in pruss_clk_mux_setup()
@ 2026-01-09 15:20 Wentao Liang
2026-01-09 16:40 ` Markus Elfring
0 siblings, 1 reply; 3+ messages in thread
From: Wentao Liang @ 2026-01-09 15:20 UTC (permalink / raw)
To: nm, ssantosh; +Cc: linux-kernel, linux-arm-kernel, Wentao Liang, stable
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>
---
Changes in v2:
- Drop error jumping lable.
---
drivers/soc/ti/pruss.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
index d7634bf5413a..07d5134b503b 100644
--- a/drivers/soc/ti/pruss.c
+++ b/drivers/soc/ti/pruss.c
@@ -368,10 +368,9 @@ static int pruss_clk_mux_setup(struct pruss *pruss, struct clk *clk_mux,
clk_mux_np);
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);
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] soc: ti: pruss: fix double free in pruss_clk_mux_setup()
2026-01-09 15:20 [PATCH v2] soc: ti: pruss: fix double free in pruss_clk_mux_setup() Wentao Liang
@ 2026-01-09 16:40 ` Markus Elfring
2026-01-09 20:04 ` Nishanth Menon
0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2026-01-09 16:40 UTC (permalink / raw)
To: vulab, linux-arm-kernel, Nishanth Menon, Santosh Shilimkar; +Cc: stable, LKML
…
> +++ b/drivers/soc/ti/pruss.c
> @@ -368,10 +368,9 @@ static int pruss_clk_mux_setup(struct pruss *pruss, struct clk *clk_mux,
> clk_mux_np);
> if (ret) {
> dev_err(dev, "failed to add clkmux free action %d", ret);
> - goto put_clk_mux_np;
> }
You may omit curly brackets here.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.19-rc4#n197
>
> - return 0;
> + return ret;
…
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] soc: ti: pruss: fix double free in pruss_clk_mux_setup()
2026-01-09 16:40 ` Markus Elfring
@ 2026-01-09 20:04 ` Nishanth Menon
0 siblings, 0 replies; 3+ messages in thread
From: Nishanth Menon @ 2026-01-09 20:04 UTC (permalink / raw)
To: Markus Elfring; +Cc: vulab, linux-arm-kernel, Santosh Shilimkar, stable, LKML
On 17:40-20260109, Markus Elfring wrote:
> …
> > +++ b/drivers/soc/ti/pruss.c
> > @@ -368,10 +368,9 @@ static int pruss_clk_mux_setup(struct pruss *pruss, struct clk *clk_mux,
> > clk_mux_np);
> > if (ret) {
> > dev_err(dev, "failed to add clkmux free action %d", ret);
> > - goto put_clk_mux_np;
> > }
>
> You may omit curly brackets here.
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.19-rc4#n197
agree.
--
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D
https://ti.com/opensource
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-09 20:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-09 15:20 [PATCH v2] soc: ti: pruss: fix double free in pruss_clk_mux_setup() Wentao Liang
2026-01-09 16:40 ` Markus Elfring
2026-01-09 20:04 ` Nishanth Menon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®