[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20221129015012.61847-1-zhengyongjun3@huawei.com>
Date: Tue, 29 Nov 2022 01:50:12 +0000
From: Zheng Yongjun <zhengyongjun3@...wei.com>
To: <qiang.zhao@....com>, <leoyang.li@....com>,
<linuxppc-dev@...ts.ozlabs.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH] soc: fsl: qe: Fix refcount leak in par_io_of_config
of_parse_phandle() returns a node pointer with refcount
incremented, we should use of_node_put() on error path.
Add missing of_node_put() to avoid refcount leak.
Fixes: 986585385131 ("[POWERPC] Add QUICC Engine (QE) infrastructure")
Signed-off-by: Zheng Yongjun <zhengyongjun3@...wei.com>
---
drivers/soc/fsl/qe/qe_io.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/soc/fsl/qe/qe_io.c b/drivers/soc/fsl/qe/qe_io.c
index a5e2d0e5ab51..e26836315167 100644
--- a/drivers/soc/fsl/qe/qe_io.c
+++ b/drivers/soc/fsl/qe/qe_io.c
@@ -159,11 +159,13 @@ int par_io_of_config(struct device_node *np)
pio_map = of_get_property(pio, "pio-map", &pio_map_len);
if (pio_map == NULL) {
printk(KERN_ERR "pio-map is not set!\n");
+ of_node_put(pio);
return -1;
}
pio_map_len /= sizeof(unsigned int);
if ((pio_map_len % 6) != 0) {
printk(KERN_ERR "pio-map format wrong!\n");
+ of_node_put(pio);
return -1;
}
--
2.17.1
Powered by blists - more mailing lists