linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND][PATCH 1/2] resize.f2fs: fix memory leak caused by migrate_nat()
       [not found] <CGME20210507110917epcas1p13e027d5e0319629c255524c8c6f6461b@epcas1p1.samsung.com>
@ 2021-05-07 11:12 ` Seung-Woo Kim
       [not found]   ` <CGME20210507110917epcas1p4a2d7ebd7e2fd8cc630fdf627ad73a003@epcas1p4.samsung.com>
  2021-05-08  6:30   ` [f2fs-dev] [RESEND][PATCH 1/2] resize.f2fs: fix memory leak caused by migrate_nat() Chao Yu
  0 siblings, 2 replies; 4+ messages in thread
From: Seung-Woo Kim @ 2021-05-07 11:12 UTC (permalink / raw)
  To: jaegeuk, linux-f2fs-devel; +Cc: linux-kernel, chao, sw0312.kim

Alloced nat_block doesn't freed from migrate_nat(). Fix to free
nat_block.

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

diff --git a/fsck/resize.c b/fsck/resize.c
index b043cd984dc6..78d578ec2cc1 100644
--- a/fsck/resize.c
+++ b/fsck/resize.c
@@ -383,6 +383,7 @@ static void migrate_nat(struct f2fs_sb_info *sbi,
 		ASSERT(ret >= 0);
 		DBG(3, "Write NAT: %lx\n", block_addr);
 	}
+	free(nat_block);
 	DBG(0, "Info: Done to migrate NAT blocks: nat_blkaddr = 0x%x -> 0x%x\n",
 			old_nat_blkaddr, new_nat_blkaddr);
 }
-- 
2.19.2


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

* [RESEND][PATCH 2/2] mkfs.f2fs: fix memory leak in not enough segments error path
       [not found]   ` <CGME20210507110917epcas1p4a2d7ebd7e2fd8cc630fdf627ad73a003@epcas1p4.samsung.com>
@ 2021-05-07 11:12     ` Seung-Woo Kim
  2021-05-08  6:31       ` [f2fs-dev] " Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: Seung-Woo Kim @ 2021-05-07 11:12 UTC (permalink / raw)
  To: jaegeuk, linux-f2fs-devel; +Cc: linux-kernel, chao, sw0312.kim

In not enough segements error path of f2fs_write_check_point_pack(),
cp_payload is not freed. Fix the error path.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
---
 mkfs/f2fs_format.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index 3f1fa32a407a..fbecb05b3302 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -723,7 +723,7 @@ static int f2fs_write_check_point_pack(void)
 
 	if (f2fs_get_usable_segments(sb) <= get_cp(overprov_segment_count)) {
 		MSG(0, "\tError: Not enough segments to create F2FS Volume\n");
-		goto free_nat_bits;
+		goto free_cp_payload;
 	}
 	MSG(0, "Info: Overprovision ratio = %.3lf%%\n", c.overprovision);
 	MSG(0, "Info: Overprovision segments = %u (GC reserved = %u)\n",
-- 
2.19.2


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

* Re: [f2fs-dev] [RESEND][PATCH 1/2] resize.f2fs: fix memory leak caused by migrate_nat()
  2021-05-07 11:12 ` [RESEND][PATCH 1/2] resize.f2fs: fix memory leak caused by migrate_nat() Seung-Woo Kim
       [not found]   ` <CGME20210507110917epcas1p4a2d7ebd7e2fd8cc630fdf627ad73a003@epcas1p4.samsung.com>
@ 2021-05-08  6:30   ` Chao Yu
  1 sibling, 0 replies; 4+ messages in thread
From: Chao Yu @ 2021-05-08  6:30 UTC (permalink / raw)
  To: Seung-Woo Kim, jaegeuk, linux-f2fs-devel; +Cc: linux-kernel

On 2021/5/7 19:12, Seung-Woo Kim wrote:
> Alloced nat_block doesn't freed from migrate_nat(). Fix to free
> nat_block.
> 
> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

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

* Re: [f2fs-dev] [RESEND][PATCH 2/2] mkfs.f2fs: fix memory leak in not enough segments error path
  2021-05-07 11:12     ` [RESEND][PATCH 2/2] mkfs.f2fs: fix memory leak in not enough segments error path Seung-Woo Kim
@ 2021-05-08  6:31       ` Chao Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2021-05-08  6:31 UTC (permalink / raw)
  To: Seung-Woo Kim, jaegeuk, linux-f2fs-devel; +Cc: linux-kernel

On 2021/5/7 19:12, Seung-Woo Kim wrote:
> In not enough segements error path of f2fs_write_check_point_pack(),
> cp_payload is not freed. Fix the error path.
> 
> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

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

end of thread, other threads:[~2021-05-08  6:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20210507110917epcas1p13e027d5e0319629c255524c8c6f6461b@epcas1p1.samsung.com>
2021-05-07 11:12 ` [RESEND][PATCH 1/2] resize.f2fs: fix memory leak caused by migrate_nat() Seung-Woo Kim
     [not found]   ` <CGME20210507110917epcas1p4a2d7ebd7e2fd8cc630fdf627ad73a003@epcas1p4.samsung.com>
2021-05-07 11:12     ` [RESEND][PATCH 2/2] mkfs.f2fs: fix memory leak in not enough segments error path Seung-Woo Kim
2021-05-08  6:31       ` [f2fs-dev] " Chao Yu
2021-05-08  6:30   ` [f2fs-dev] [RESEND][PATCH 1/2] resize.f2fs: fix memory leak caused by migrate_nat() Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).