All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mtd: Fix resource leaks in for_each_child_of_node() loops
@ 2023-07-10  6:10 ` Yang Rong
  0 siblings, 0 replies; 3+ messages in thread
From: Yang Rong @ 2023-07-10  6:10 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	open list:MEMORY TECHNOLOGY DEVICES (MTD),
	open list
  Cc: opensource.kernel, luhongfei, Yang Rong

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2] mtd: Fix resource leaks in for_each_child_of_node() loops
@ 2023-07-10  6:10 ` Yang Rong
  0 siblings, 0 replies; 3+ messages in thread
From: Yang Rong @ 2023-07-10  6:10 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	open list:MEMORY TECHNOLOGY DEVICES (MTD),
	open list
  Cc: opensource.kernel, luhongfei, Yang Rong

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


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mtd: Fix resource leaks in for_each_child_of_node() loops
  2023-07-10  6:10 ` Yang Rong
  (?)
@ 2023-07-10 17:19 ` Markus Elfring
  -1 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2023-07-10 17:19 UTC (permalink / raw)
  To: Yang Rong, linux-mtd, kernel-janitors, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra
  Cc: opensource.kernel, LKML, Lu Hongfei

Would a subject like “[PATCH v3] mtd: core: Fix resource leak in a for_each_child_of_node() loop”
be more appropriate?


> Ensure child node references are decremented properly in the error path.

How do you think about the following wording variant?

  Ensure child node references are properly decremented in the error path
  of this function implementation.


Would you like to add the tag “Fixes” because of the completion
of the exception handling?

Regards,
Markus

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-10 17:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-10  6:10 [PATCH v2] mtd: Fix resource leaks in for_each_child_of_node() loops Yang Rong
2023-07-10  6:10 ` Yang Rong
2023-07-10 17:19 ` Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.