[PATCH] ext2: Fix NULL ptr dereference in ext2_msg_fc()
From: Jan Kara
Date: Fri Nov 20 2026 - 08:03:58 EST
When mount parameters emitting messages are configured before
fc->source, we crash in ext2_msg_fc() when trying to create a fs
identifier for the filesystem from fc->source. Just use unknown in that
case.
Fixes: 98f18c76c2c3 ("ext2: create ext2_msg_fc for use during parsing")
Reported-by: syzbot+1d23ad199a3bfd6f9149@xxxxxxxxxxxxxxxxxxxxxxxxx
Signed-off-by: Jan Kara <jack@xxxxxxx>
---
fs/ext2/super.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 54a6c26d0388..63a3a212a0ec 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -89,13 +89,15 @@ static void ext2_msg_fc(struct fs_context *fc, const char *prefix,
if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) {
s_id = fc->root->d_sb->s_id;
- } else {
+ } else if (fc->source) {
/* get last path component of source */
s_id = strrchr(fc->source, '/');
if (s_id)
s_id++;
else
s_id = fc->source;
+ } else {
+ s_id = "unknown";
}
va_start(args, fmt);
--
2.53.0
--rizs2fl6skraupwk--