From: Gowtham S Bhushan <gowtham398gs@gmail.com>
To: Luis de Bethencourt <luisbg@kernel.org>,
Salah Triki <salah.triki@gmail.com>
Cc: linux-kernel@vger.kernel.org,
syzbot+fc26c366038b54261e53@syzkaller.appspotmail.com,
Gowtham S Bhushan <gowtham398gs@gmail.com>
Subject: [PATCH] befs: fix shift-out-of-bounds in befs_check_sb
Date: Mon, 26 Oct 2026 20:04:47 +0530 [thread overview]
Message-ID: <20261026143447.201827-1-gowtham398gs@gmail.com> (raw)
The consistency check for the block_size by using the block_shift caused
integer overflow. Thus a max limit to the block_shift was defined named
BEFS_MAX_BLOCK_SHIFT in befs.h. Also check for the block_shift was added
so that overflow does not occur.
Reported-by: syzbot+fc26c366038b54261e53@syzkaller.appspotmail.com
Closes: https://://appspotmail.com/bug?extid=fc26c366038b54261e53
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Gowtham S Bhushan <gowtham398gs@gmail.com>
---
fs/befs/befs.h | 2 +-
fs/befs/super.c | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/fs/befs/befs.h b/fs/befs/befs.h
index 7cd47245694d..c395eb5e9a10 100644
--- a/fs/befs/befs.h
+++ b/fs/befs/befs.h
@@ -13,7 +13,7 @@
/* used in debug.c */
#define BEFS_VERSION "0.9.3"
-
+#define BEFS_MAX_BLOCK_SHIFT 31
typedef u64 befs_blocknr_t;
/*
diff --git a/fs/befs/super.c b/fs/befs/super.c
index 7c50025c99d8..e515e98cb3f4 100644
--- a/fs/befs/super.c
+++ b/fs/befs/super.c
@@ -88,6 +88,16 @@ befs_check_sb(struct super_block *sb)
return BEFS_ERR;
}
+ /*
+ * block_shift check added so that overflow does not
+ * occer during the block_size check
+ */
+
+ if (befs_sb->block_shift > BEFS_MAX_BLOCK_SHIFT) {
+ befs_error(sb, "block_size too large, Corruption likely. ");
+ return BEFS_ERR;
+ }
+
/*
* block_shift and block_size encode the same information
* in different ways as a consistency check.
--
2.56.0
reply other threads:[~2026-10-26 14:35 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=20261026143447.201827-1-gowtham398gs@gmail.com \
--to=gowtham398gs@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luisbg@kernel.org \
--cc=salah.triki@gmail.com \
--cc=syzbot+fc26c366038b54261e53@syzkaller.appspotmail.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 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®