From: Ye Bin <yebin10@huawei.com>
To: <jack@suse.comu>, <linux-ext4@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, Ye Bin <yebin10@huawei.com>
Subject: [PATCH -next RFC] ext2: Add check if block is step over super block
Date: Mon, 1 Nov 2021 17:33:51 +0800 [thread overview]
Message-ID: <20211101093351.1164368-1-yebin10@huawei.com> (raw)
We got an issue that super block is allocated by file system when run syzkaller
test. We add debug information find that origin image super block's block bitmap
is zero. There isn't check whether block is step over super block in ext2_new_blocks.
In order not to make things worse, we'd better to add check if block step over
super block when new blocks.
Signed-off-by: Ye Bin <yebin10@huawei.com>
---
fs/ext2/balloc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
index c17ccc19b938..b93d52e6a17a 100644
--- a/fs/ext2/balloc.c
+++ b/fs/ext2/balloc.c
@@ -1376,7 +1376,8 @@ ext2_fsblk_t ext2_new_blocks(struct inode *inode, ext2_fsblk_t goal,
in_range(ret_block, le32_to_cpu(gdp->bg_inode_table),
EXT2_SB(sb)->s_itb_per_group) ||
in_range(ret_block + num - 1, le32_to_cpu(gdp->bg_inode_table),
- EXT2_SB(sb)->s_itb_per_group)) {
+ EXT2_SB(sb)->s_itb_per_group) ||
+ in_range(EXT2_SB(sb)->s_sb_block, ret_block, num)) {
ext2_error(sb, "ext2_new_blocks",
"Allocating block in system zone - "
"blocks from "E2FSBLK", length %lu",
--
2.31.1
reply other threads:[~2021-11-01 9:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20211101093351.1164368-1-yebin10@huawei.com \
--to=yebin10@huawei.com \
--cc=jack@suse.comu \
--cc=linux-ext4@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®