Commit 09bd7af9 authored by Miaoqian Lin's avatar Miaoqian Lin Committed by Huang Xiaojia
Browse files

powerpc/fsl_rio: Fix refcount leak in fsl_rio_setup

stable inclusion
from stable-v4.19.247
commit 5b8aa2ba38c010f47c965dd9bb5a8561813ed649
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IBP5WK
CVE: CVE-2022-49439

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



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

[ Upstream commit fcee9692 ]

of_parse_phandle() returns a node pointer with refcount
incremented, we should use of_node_put() on it when not need anymore.
Add missing of_node_put() to avoid refcount leak.

Fixes: abc3aeae ("fsl-rio: Add two ports and rapidio message units support")
Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220512123724.62931-1-linmq006@gmail.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarHuang Xiaojia <huangxiaojia2@huawei.com>
parent 55990887
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -509,8 +509,10 @@ int fsl_rio_setup(struct platform_device *dev)
	if (rc) {
		dev_err(&dev->dev, "Can't get %pOF property 'reg'\n",
				rmu_node);
		of_node_put(rmu_node);
		goto err_rmu;
	}
	of_node_put(rmu_node);
	rmu_regs_win = ioremap(rmu_regs.start, resource_size(&rmu_regs));
	if (!rmu_regs_win) {
		dev_err(&dev->dev, "Unable to map rmu register window\n");