From: Chunguang Xu <brookxu.cn@gmail.com>
To: tytso@mit.edu, adilger.kernel@dilger.ca
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH v2 8/8] ext4: fix a memory leak of ext4_free_data
Date: Mon, 19 Oct 2020 17:02:38 +0800 [thread overview]
Message-ID: <1603098158-30406-8-git-send-email-brookxu@tencent.com> (raw)
In-Reply-To: <1603098158-30406-1-git-send-email-brookxu@tencent.com>
From: Chunguang Xu <brookxu@tencent.com>
When freeing metadata, we will create an ext4_free_data and
insert it into the pending free list. After the current
transaction is committed, the object will be freed.
ext4_mb_free_metadata() will check whether the area to be
freed overlaps with the pending free list. If true, return
directly. At this time, ext4_free_data is leaked. Fortunately,
the probability of this problem is relatively small, maybe we
should fix this problem.
Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
fs/ext4/mballoc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index e0a4265..aa6732a 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -5015,6 +5015,7 @@ static void ext4_try_merge_freed_extent(struct ext4_sb_info *sbi,
ext4_group_first_block_no(sb, group) +
EXT4_C2B(sbi, cluster),
"Block already on to-be-freed list");
+ kmem_cache_free(ext4_free_data_cachep, new_entry);
return 0;
}
}
--
1.8.3.1
next prev parent reply other threads:[~2020-10-19 9:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-19 9:02 [PATCH v2 1/8] ext4: use ASSERT() to replace J_ASSERT() Chunguang Xu
2020-10-19 9:02 ` [PATCH v2 2/8] ext4: remove redundant mb_regenerate_buddy() Chunguang Xu
2020-10-19 9:02 ` [PATCH v2 3/8] ext4: simplify the code of mb_find_order_for_block Chunguang Xu
2020-10-19 9:02 ` [PATCH v2 4/8] ext4: add the gdt block of meta_bg to system_zone Chunguang Xu
2020-10-19 9:02 ` [PATCH v2 5/8] ext4: update ext4_data_block_valid related comments Chunguang Xu
2020-10-19 9:02 ` [PATCH v2 6/8] ext4: add a helper function to validate metadata block Chunguang Xu
2020-10-19 9:02 ` [PATCH v2 7/8] ext4: delete invalid code inside ext4_xattr_block_set() Chunguang Xu
2020-10-19 9:02 ` Chunguang Xu [this message]
2020-10-20 3:37 ` [PATCH v2 1/8] ext4: use ASSERT() to replace J_ASSERT() Andreas Dilger
2020-10-20 5:03 ` brookxu
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=1603098158-30406-8-git-send-email-brookxu@tencent.com \
--to=brookxu.cn@gmail.com \
--cc=adilger.kernel@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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 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).