From: Greg Kroah-Hartman Date: Fri, 9 Jan 2026 10:00:57 +0000 (+0100) Subject: 6.1-stable patches X-Git-Tag: v6.1.160~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6530e2ce75f20a73645c8b7afdeea8bc8f28a5e;p=thirdparty%2Fkernel%2Fstable-queue.git 6.1-stable patches added patches: ext4-factor-out-ext4_hash_info_init.patch ext4-filesystems-without-casefold-feature-cannot-be-mounted-with-siphash.patch ext4-fix-error-message-when-rejecting-the-default-hash.patch --- diff --git a/queue-6.1/ext4-factor-out-ext4_hash_info_init.patch b/queue-6.1/ext4-factor-out-ext4_hash_info_init.patch new file mode 100644 index 0000000000..99bc57b027 --- /dev/null +++ b/queue-6.1/ext4-factor-out-ext4_hash_info_init.patch @@ -0,0 +1,91 @@ +From stable+bounces-206363-greg=kroah.com@vger.kernel.org Thu Jan 8 17:30:10 2026 +From: Thadeu Lima de Souza Cascardo +Date: Thu, 8 Jan 2026 12:04:08 -0300 +Subject: ext4: factor out ext4_hash_info_init() +To: stable@vger.kernel.org +Cc: Gabriel Krisman Bertazi , Jason Yan , Theodore Ts'o , Thadeu Lima de Souza Cascardo +Message-ID: <20260108150409.3354721-2-cascardo@igalia.com> + +From: Jason Yan + +commit db9345d9e6f075e1ec26afadf744078ead935fec upstream. + +Factor out ext4_hash_info_init() to simplify __ext4_fill_super(). No +functional change. + +Signed-off-by: Jason Yan +Link: https://lore.kernel.org/r/20230323140517.1070239-2-yanaijie@huawei.com +Signed-off-by: Theodore Ts'o +Stable-dep-of: a2187431c395 ("ext4: fix error message when rejecting the default hash") +Signed-off-by: Thadeu Lima de Souza Cascardo +Signed-off-by: Greg Kroah-Hartman +--- + fs/ext4/super.c | 50 ++++++++++++++++++++++++++++++-------------------- + 1 file changed, 30 insertions(+), 20 deletions(-) + +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -5043,6 +5043,35 @@ out: + return ret; + } + ++static void ext4_hash_info_init(struct super_block *sb) ++{ ++ struct ext4_sb_info *sbi = EXT4_SB(sb); ++ struct ext4_super_block *es = sbi->s_es; ++ unsigned int i; ++ ++ for (i = 0; i < 4; i++) ++ sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]); ++ ++ sbi->s_def_hash_version = es->s_def_hash_version; ++ if (ext4_has_feature_dir_index(sb)) { ++ i = le32_to_cpu(es->s_flags); ++ if (i & EXT2_FLAGS_UNSIGNED_HASH) ++ sbi->s_hash_unsigned = 3; ++ else if ((i & EXT2_FLAGS_SIGNED_HASH) == 0) { ++#ifdef __CHAR_UNSIGNED__ ++ if (!sb_rdonly(sb)) ++ es->s_flags |= ++ cpu_to_le32(EXT2_FLAGS_UNSIGNED_HASH); ++ sbi->s_hash_unsigned = 3; ++#else ++ if (!sb_rdonly(sb)) ++ es->s_flags |= ++ cpu_to_le32(EXT2_FLAGS_SIGNED_HASH); ++#endif ++ } ++ } ++} ++ + static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) + { + struct ext4_super_block *es = NULL; +@@ -5195,26 +5224,7 @@ static int __ext4_fill_super(struct fs_c + sbi->s_addr_per_block_bits = ilog2(EXT4_ADDR_PER_BLOCK(sb)); + sbi->s_desc_per_block_bits = ilog2(EXT4_DESC_PER_BLOCK(sb)); + +- for (i = 0; i < 4; i++) +- sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]); +- sbi->s_def_hash_version = es->s_def_hash_version; +- if (ext4_has_feature_dir_index(sb)) { +- i = le32_to_cpu(es->s_flags); +- if (i & EXT2_FLAGS_UNSIGNED_HASH) +- sbi->s_hash_unsigned = 3; +- else if ((i & EXT2_FLAGS_SIGNED_HASH) == 0) { +-#ifdef __CHAR_UNSIGNED__ +- if (!sb_rdonly(sb)) +- es->s_flags |= +- cpu_to_le32(EXT2_FLAGS_UNSIGNED_HASH); +- sbi->s_hash_unsigned = 3; +-#else +- if (!sb_rdonly(sb)) +- es->s_flags |= +- cpu_to_le32(EXT2_FLAGS_SIGNED_HASH); +-#endif +- } +- } ++ ext4_hash_info_init(sb); + + if (ext4_handle_clustersize(sb)) + goto failed_mount; diff --git a/queue-6.1/ext4-filesystems-without-casefold-feature-cannot-be-mounted-with-siphash.patch b/queue-6.1/ext4-filesystems-without-casefold-feature-cannot-be-mounted-with-siphash.patch new file mode 100644 index 0000000000..d90262d467 --- /dev/null +++ b/queue-6.1/ext4-filesystems-without-casefold-feature-cannot-be-mounted-with-siphash.patch @@ -0,0 +1,43 @@ +From stable+bounces-206362-greg=kroah.com@vger.kernel.org Thu Jan 8 16:24:17 2026 +From: Thadeu Lima de Souza Cascardo +Date: Thu, 8 Jan 2026 12:04:07 -0300 +Subject: ext4: filesystems without casefold feature cannot be mounted with siphash +To: stable@vger.kernel.org +Cc: Gabriel Krisman Bertazi , Lizhi Xu , syzbot+340581ba9dceb7e06fb3@syzkaller.appspotmail.com, Theodore Ts'o , Thadeu Lima de Souza Cascardo +Message-ID: <20260108150409.3354721-1-cascardo@igalia.com> + +From: Lizhi Xu + +commit 985b67cd86392310d9e9326de941c22fc9340eec upstream. + +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 +Link: https://patch.msgid.link/20240605012335.44086-1-lizhi.xu@windriver.com +Signed-off-by: Theodore Ts'o +[cascardo: small conflict fixup] +Signed-off-by: Thadeu Lima de Souza Cascardo +Signed-off-by: Greg Kroah-Hartman +--- + fs/ext4/super.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -3552,6 +3552,14 @@ int ext4_feature_set_ok(struct super_blo + } + #endif + ++ 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 siphash"); ++ return 0; ++ } ++ + if (readonly) + return 1; + diff --git a/queue-6.1/ext4-fix-error-message-when-rejecting-the-default-hash.patch b/queue-6.1/ext4-fix-error-message-when-rejecting-the-default-hash.patch new file mode 100644 index 0000000000..c37b05d0e2 --- /dev/null +++ b/queue-6.1/ext4-fix-error-message-when-rejecting-the-default-hash.patch @@ -0,0 +1,108 @@ +From stable+bounces-206364-greg=kroah.com@vger.kernel.org Thu Jan 8 16:14:20 2026 +From: Thadeu Lima de Souza Cascardo +Date: Thu, 8 Jan 2026 12:04:09 -0300 +Subject: ext4: fix error message when rejecting the default hash +To: stable@vger.kernel.org +Cc: Gabriel Krisman Bertazi , Theodore Ts'o , Thadeu Lima de Souza Cascardo +Message-ID: <20260108150409.3354721-3-cascardo@igalia.com> + +From: Gabriel Krisman Bertazi + +commit a2187431c395cdfbf144e3536f25468c64fc7cfa upstream. + +Commit 985b67cd8639 ("ext4: filesystems without casefold feature cannot +be mounted with siphash") properly rejects volumes where +s_def_hash_version is set to DX_HASH_SIPHASH, but the check and the +error message should not look into casefold setup - a filesystem should +never have DX_HASH_SIPHASH as the default hash. Fix it and, since we +are there, move the check to ext4_hash_info_init. + +Fixes:985b67cd8639 ("ext4: filesystems without casefold feature cannot +be mounted with siphash") + +Signed-off-by: Gabriel Krisman Bertazi +Link: https://patch.msgid.link/87jzg1en6j.fsf_-_@mailhost.krisman.be +Signed-off-by: Theodore Ts'o +Signed-off-by: Thadeu Lima de Souza Cascardo +Signed-off-by: Greg Kroah-Hartman +--- + fs/ext4/ext4.h | 1 + + fs/ext4/super.c | 28 +++++++++++++++++----------- + 2 files changed, 18 insertions(+), 11 deletions(-) + +--- a/fs/ext4/ext4.h ++++ b/fs/ext4/ext4.h +@@ -2460,6 +2460,7 @@ static inline __le16 ext4_rec_len_to_dis + #define DX_HASH_HALF_MD4_UNSIGNED 4 + #define DX_HASH_TEA_UNSIGNED 5 + #define DX_HASH_SIPHASH 6 ++#define DX_HASH_LAST DX_HASH_SIPHASH + + static inline u32 ext4_chksum(struct ext4_sb_info *sbi, u32 crc, + const void *address, unsigned int length) +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -3552,14 +3552,6 @@ int ext4_feature_set_ok(struct super_blo + } + #endif + +- 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 siphash"); +- return 0; +- } +- + if (readonly) + return 1; + +@@ -5043,16 +5035,27 @@ out: + return ret; + } + +-static void ext4_hash_info_init(struct super_block *sb) ++static int ext4_hash_info_init(struct super_block *sb) + { + struct ext4_sb_info *sbi = EXT4_SB(sb); + struct ext4_super_block *es = sbi->s_es; + unsigned int i; + ++ sbi->s_def_hash_version = es->s_def_hash_version; ++ ++ if (sbi->s_def_hash_version > DX_HASH_LAST) { ++ ext4_msg(sb, KERN_ERR, ++ "Invalid default hash set in the superblock"); ++ return -EINVAL; ++ } else if (sbi->s_def_hash_version == DX_HASH_SIPHASH) { ++ ext4_msg(sb, KERN_ERR, ++ "SIPHASH is not a valid default hash value"); ++ return -EINVAL; ++ } ++ + for (i = 0; i < 4; i++) + sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]); + +- sbi->s_def_hash_version = es->s_def_hash_version; + if (ext4_has_feature_dir_index(sb)) { + i = le32_to_cpu(es->s_flags); + if (i & EXT2_FLAGS_UNSIGNED_HASH) +@@ -5070,6 +5073,7 @@ static void ext4_hash_info_init(struct s + #endif + } + } ++ return 0; + } + + static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) +@@ -5224,7 +5228,9 @@ static int __ext4_fill_super(struct fs_c + sbi->s_addr_per_block_bits = ilog2(EXT4_ADDR_PER_BLOCK(sb)); + sbi->s_desc_per_block_bits = ilog2(EXT4_DESC_PER_BLOCK(sb)); + +- ext4_hash_info_init(sb); ++ err = ext4_hash_info_init(sb); ++ if (err) ++ goto failed_mount; + + if (ext4_handle_clustersize(sb)) + goto failed_mount; diff --git a/queue-6.1/series b/queue-6.1/series index f0aa234ca7..29403b2192 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -616,3 +616,6 @@ usb-xhci-apply-the-link-chain-quirk-on-nec-isoc-endpoints.patch sched-fair-small-cleanup-to-sched_balance_newidle.patch sched-fair-small-cleanup-to-update_newidle_cost.patch sched-fair-proportional-newidle-balance.patch +ext4-filesystems-without-casefold-feature-cannot-be-mounted-with-siphash.patch +ext4-factor-out-ext4_hash_info_init.patch +ext4-fix-error-message-when-rejecting-the-default-hash.patch