[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20230710061412.2272-1-yangrong@vivo.com>
Date: Mon, 10 Jul 2023 14:10:04 +0800
From: Yang Rong <yangrong@...o.com>
To: Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>,
linux-mtd@...ts.infradead.org (open list:MEMORY TECHNOLOGY DEVICES
(MTD)), linux-kernel@...r.kernel.org (open list)
Cc: opensource.kernel@...o.com, luhongfei@...o.com,
Yang Rong <yangrong@...o.com>
Subject: [PATCH v2] mtd: Fix resource leaks in for_each_child_of_node() loops
Ensure child node references are decremented properly in the error path.
Signed-off-by: Yang Rong <yangrong@...o.com>
---
v1: https://lore.kernel.org/all/20230621024517.1155-1-yangrong@vivo.com/
The modifications made copared to the previous version are as follows:
1.I have changed the Subject to provide a clearer description of the issue.
2.I have simplified the commit message.
drivers/mtd/mtdcore.c | 1 +
1 file changed, 1 insertion(+)
mode change 100644 => 100755 drivers/mtd/mtdcore.c
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index e00b12aa5ec9..b02cb8b1a38d
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -591,6 +591,7 @@ static void mtd_check_of_node(struct mtd_info *mtd)
if (plen == mtd_name_len &&
!strncmp(mtd->name, pname + offset, plen)) {
mtd_set_of_node(mtd, mtd_dn);
+ of_node_put(mtd_dn);
break;
}
}
--
2.35.3
Powered by blists - more mailing lists