All of lore.kernel.org
 help / color / mirror / Atom feed
From: Seung-Woo Kim <sw0312.kim@samsung.com>
To: jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org, chao@kernel.org, sw0312.kim@samsung.com
Subject: [PATCH 1/2] fsck.f2fs: fix memory leak caused by fsck_chk_orphan_node()
Date: Mon, 10 May 2021 17:57:25 +0900	[thread overview]
Message-ID: <20210510085726.12663-1-sw0312.kim@samsung.com> (raw)
In-Reply-To: CGME20210510085419epcas1p1e16c3966fc1b7b9f28a797eaa588f3ba@epcas1p1.samsung.com

With invalid node info from fsck_chk_orphan_node(), orphan_blk
and new_blk are not freed. Fix memory leak in the path.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
---
 fsck/fsck.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fsck/fsck.c b/fsck/fsck.c
index e52672032d2c..6019775dcb2d 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -1780,8 +1780,11 @@ int fsck_chk_orphan_node(struct f2fs_sb_info *sbi)
 			if (c.preen_mode == PREEN_MODE_1 && !c.fix_on) {
 				get_node_info(sbi, ino, &ni);
 				if (!IS_VALID_NID(sbi, ino) ||
-						!IS_VALID_BLK_ADDR(sbi, ni.blk_addr))
+				    !IS_VALID_BLK_ADDR(sbi, ni.blk_addr)) {
+					free(orphan_blk);
+					free(new_blk);
 					return -EINVAL;
+				}
 
 				continue;
 			}
-- 
2.19.2


WARNING: multiple messages have this Message-ID (diff)
From: Seung-Woo Kim <sw0312.kim@samsung.com>
To: jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net
Cc: sw0312.kim@samsung.com, linux-kernel@vger.kernel.org
Subject: [f2fs-dev] [PATCH 1/2] fsck.f2fs: fix memory leak caused by fsck_chk_orphan_node()
Date: Mon, 10 May 2021 17:57:25 +0900	[thread overview]
Message-ID: <20210510085726.12663-1-sw0312.kim@samsung.com> (raw)
In-Reply-To: CGME20210510085419epcas1p1e16c3966fc1b7b9f28a797eaa588f3ba@epcas1p1.samsung.com

With invalid node info from fsck_chk_orphan_node(), orphan_blk
and new_blk are not freed. Fix memory leak in the path.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
---
 fsck/fsck.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fsck/fsck.c b/fsck/fsck.c
index e52672032d2c..6019775dcb2d 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -1780,8 +1780,11 @@ int fsck_chk_orphan_node(struct f2fs_sb_info *sbi)
 			if (c.preen_mode == PREEN_MODE_1 && !c.fix_on) {
 				get_node_info(sbi, ino, &ni);
 				if (!IS_VALID_NID(sbi, ino) ||
-						!IS_VALID_BLK_ADDR(sbi, ni.blk_addr))
+				    !IS_VALID_BLK_ADDR(sbi, ni.blk_addr)) {
+					free(orphan_blk);
+					free(new_blk);
 					return -EINVAL;
+				}
 
 				continue;
 			}
-- 
2.19.2



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

       reply	other threads:[~2021-05-10  8:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210510085419epcas1p1e16c3966fc1b7b9f28a797eaa588f3ba@epcas1p1.samsung.com>
2021-05-10  8:57 ` Seung-Woo Kim [this message]
2021-05-10  8:57   ` [f2fs-dev] [PATCH 1/2] fsck.f2fs: fix memory leak caused by fsck_chk_orphan_node() Seung-Woo Kim
     [not found]   ` <CGME20210510085419epcas1p3e72ea9d956bcf811167b14e06fb08149@epcas1p3.samsung.com>
2021-05-10  8:57     ` [PATCH 2/2] dump.f2fs: fix memory leak caused by dump_node_blk() Seung-Woo Kim
2021-05-10  8:57       ` [f2fs-dev] " Seung-Woo Kim
2021-05-11  3:19       ` Chao Yu
2021-05-11  3:19         ` Chao Yu
2021-05-11  3:18   ` [f2fs-dev] [PATCH 1/2] fsck.f2fs: fix memory leak caused by fsck_chk_orphan_node() Chao Yu
2021-05-11  3:18     ` Chao Yu

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=20210510085726.12663-1-sw0312.kim@samsung.com \
    --to=sw0312.kim@samsung.com \
    --cc=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /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.