diff mbox series

[V6] fs/ext4: Filesystem without casefold feature cannot be mounted with spihash

Message ID 20240605012335.44086-1-lizhi.xu@windriver.com
State New
Headers show
Series [V6] fs/ext4: Filesystem without casefold feature cannot be mounted with spihash | expand

Commit Message

Lizhi Xu June 5, 2024, 1:23 a.m. UTC
When mounting the ext4 filesystem, if the default hash version is set to 
DX_HASH_SIPHASH but the casefold feature is not set, exit the mounting.

Reported-by: syzbot+340581ba9dceb7e06fb3@syzkaller.appspotmail.com
Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
---
 fs/ext4/super.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index c682fb927b64..d0645af3e66e 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3593,6 +3593,14 @@  int ext4_feature_set_ok(struct super_block *sb, int readonly)
 			 "mounted without CONFIG_UNICODE");
 		return 0;
 	}
+#else
+	if (EXT4_SB(sb)->s_es->s_def_hash_version == DX_HASH_SIPHASH &&
+	    !ext4_has_feature_casefold(sb)) {
+		ext4_msg(sb, KERN_ERR,
+			 "Filesystem without casefold feature cannot be "
+			 "mounted with spihash");
+		return 0;
+	}
 #endif
 
 	if (readonly)