lkml.org 
[lkml]   [2023]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2] mtd: Fix resource leaks in for_each_child_of_node() loops
Date
Ensure child node references are decremented properly in the error path.

Signed-off-by: Yang Rong <yangrong@vivo.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
\
 
 \ /
  Last update: 2023-07-10 10:51    [W:0.039 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site