summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinkai Gong <gonglinkai@kylinos.cn>2026-08-13 17:56:17 +0800
committerAndi Shyti <andi.shyti@kernel.org>2026-08-19 21:55:53 +0200
commit62edb8ca0aa44517cc23cfa26cd8a51f15ea92fe (patch)
tree135e24d815b8b650772b3bf26fc96de39672f024
parent43eb13f13385a1e7251978a1977ac61b99edef01 (diff)
downloadlinux-62edb8ca0aa44517cc23cfa26cd8a51f15ea92fe.tar.gz
linux-62edb8ca0aa44517cc23cfa26cd8a51f15ea92fe.zip
i2c: mux: demux-pinctrl: fix OF node leak on kstrdup failure
of_parse_phandle() takes a reference on the parent node. If a later devm_kstrdup() fails, err_rollback only releases nodes for indices 0..i-1, so the current node is leaked. of_node_put() the current parent before rolling back. Fixes: 7c0195fa9a9e ("i2c: mux: demux-pinctrl: check the return value of devm_kstrdup()") Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn> Cc: <stable@vger.kernel.org> # v6.6+ Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://patch.msgid.link/20260813095617.2246320-1-gonglinkai@kylinos.cn
-rw-r--r--drivers/i2c/muxes/i2c-demux-pinctrl.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c
index f2a1f4744978..2403c0bf7c43 100644
--- a/drivers/i2c/muxes/i2c-demux-pinctrl.c
+++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c
@@ -247,6 +247,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev)
props[i].value = devm_kstrdup(&pdev->dev, "ok", GFP_KERNEL);
if (!props[i].name || !props[i].value) {
err = -ENOMEM;
+ of_node_put(adap_np);
goto err_rollback;
}
props[i].length = 3;