All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Rong <yangrong@vivo.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org (open list:MEMORY TECHNOLOGY
	DEVICES (MTD)), linux-kernel@vger.kernel.org (open list)
Cc: opensource.kernel@vivo.com, luhongfei@vivo.com,
	Yang Rong <yangrong@vivo.com>
Subject: [PATCH v2] mtd: Fix resource leaks in for_each_child_of_node() loops
Date: Mon, 10 Jul 2023 14:10:04 +0800	[thread overview]
Message-ID: <20230710061412.2272-1-yangrong@vivo.com> (raw)

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


WARNING: multiple messages have this Message-ID (diff)
From: Yang Rong <yangrong@vivo.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org (open list:MEMORY TECHNOLOGY
	DEVICES (MTD)), linux-kernel@vger.kernel.org (open list)
Cc: opensource.kernel@vivo.com, luhongfei@vivo.com,
	Yang Rong <yangrong@vivo.com>
Subject: [PATCH v2] mtd: Fix resource leaks in for_each_child_of_node() loops
Date: Mon, 10 Jul 2023 14:10:04 +0800	[thread overview]
Message-ID: <20230710061412.2272-1-yangrong@vivo.com> (raw)

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/

             reply	other threads:[~2023-07-10  8:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10  6:10 Yang Rong [this message]
2023-07-10  6:10 ` [PATCH v2] mtd: Fix resource leaks in for_each_child_of_node() loops Yang Rong
2023-07-10 17:19 ` Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230710061412.2272-1-yangrong@vivo.com \
    --to=yangrong@vivo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=luhongfei@vivo.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=opensource.kernel@vivo.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.