soc: ti: pruss: fix double free in pruss_clk_mux_setup()
Subsystems (2)
PATCH v3 1/1 soc: ti: pruss: fix double free in pruss_clk_mux_setup()
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().
---
Changes in v2:
- Drop error jumping label.
Changes in v3:
- Omit curly brackets.
--- drivers/soc/ti/pruss.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/soc/ti/pruss.c +2 -4
@@ -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);
Signature · 1 line
2.34.1
Hi Wentao Liang,
Quoted 9 lines · Wentao Liang
In the
pruss_clk_mux_setup(), thedevm_add_action_or_reset()indirectly callspruss_of_free_clk_provider(), which callsof_node_put(clk_mux_np)on the error path. However, after thedevm_add_action_or_reset()returns, theof_node_put(clk_mux_np)is called again, causing a double free.Fix by returning directly, to avoid the duplicate
of_node_put().[...]
I have applied the following to branch ti-drivers-soc-next on [1]. Thank you!
[1/1] soc: ti: pruss: fix double free in pruss_clk_mux_setup()
commit: 80db65d4acfb9ff12d00172aed39ea8b98261aad
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent up the chain during the next merge window (or sooner if it is a relevant bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/ti/linux.git
Signature · 4 lines
Regards, Nishanth Menon Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D https://ti.com/opensource