提交 2d760d20 编写于 作者: M Miaoqian Lin 提交者: Zheng Zengkai

remoteproc: k3-r5: Fix refcount leak in k3_r5_cluster_of_init

stable inclusion
from stable-v5.10.137
commit 75358732af9b26acfe3e609943290bcba13330fc
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I60PLB

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=75358732af9b26acfe3e609943290bcba13330fc

--------------------------------

[ Upstream commit fa220c05 ]

Every iteration of for_each_available_child_of_node() decrements
the reference count of the previous node.
When breaking early from a for_each_available_child_of_node() loop,
we need to explicitly call of_node_put() on the child node.
Add missing of_node_put() to avoid refcount leak.

Fixes: 6dedbd1d ("remoteproc: k3-r5: Add a remoteproc driver for R5F subsystem")
Signed-off-by: NMiaoqian Lin <linmq006@gmail.com>
Acked-by: NSuman Anna <s-anna@ti.com>
Link: https://lore.kernel.org/r/20220605083334.23942-1-linmq006@gmail.comSigned-off-by: NMathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 9732d182
...@@ -1283,6 +1283,7 @@ static int k3_r5_cluster_of_init(struct platform_device *pdev) ...@@ -1283,6 +1283,7 @@ static int k3_r5_cluster_of_init(struct platform_device *pdev)
if (!cpdev) { if (!cpdev) {
ret = -ENODEV; ret = -ENODEV;
dev_err(dev, "could not get R5 core platform device\n"); dev_err(dev, "could not get R5 core platform device\n");
of_node_put(child);
goto fail; goto fail;
} }
...@@ -1291,6 +1292,7 @@ static int k3_r5_cluster_of_init(struct platform_device *pdev) ...@@ -1291,6 +1292,7 @@ static int k3_r5_cluster_of_init(struct platform_device *pdev)
dev_err(dev, "k3_r5_core_of_init failed, ret = %d\n", dev_err(dev, "k3_r5_core_of_init failed, ret = %d\n",
ret); ret);
put_device(&cpdev->dev); put_device(&cpdev->dev);
of_node_put(child);
goto fail; goto fail;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册