Skip to contentSkip to conversation

Fix uninitialized variable in ext4_inlinedir_to_tree

PATCH Applied Xiaxi Shen 2 participants 2 messages May 1, 2024 – Jun 28, 2024 ext4 file system

lore
Share & tools
lore

Xiaxi Shen

author
#0 lore raw

PATCH 1/1 Fix uninitialized variable in ext4_inlinedir_to_tree

Syzbot has found an uninit-value bug in ext4_inlinedir_to_tree

This error happens because ext4_inlinedir_to_tree does not handle the case when ext4fs_dirhash returns an error

This can be avoided by checking the return value of ext4fs_dirhash and propagating the error,
similar to how it's done with ext4_htree_store_dirent

---
 fs/ext4/inline.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
fs/ext4/inline.c +5 -1
index d5bd1e3a5d36..e7a09a99837b 100644
@@ -1410,7 +1410,11 @@ int ext4_inlinedir_to_tree(struct file *dir_file,
 			hinfo->hash = EXT4_DIRENT_HASH(de);
 			hinfo->minor_hash = EXT4_DIRENT_MINOR_HASH(de);
 		} else {
-			ext4fs_dirhash(dir, de->name, de->name_len, hinfo);
+			err = ext4fs_dirhash(dir, de->name, de->name_len, hinfo);
+			if (err) {
+				ret = err;
+				goto out;
+			}
 		}
 		if ((hinfo->hash < start_hash) ||
 		    ((hinfo->hash == start_hash) &&
Signature · 1 line
2.34.1
maintainer Applied
#1 lore raw
Quoted 10 lines · Xiaxi Shen

Syzbot has found an uninit-value bug in ext4_inlinedir_to_tree

This error happens because ext4_inlinedir_to_tree does not handle the case when ext4fs_dirhash returns an error

This can be avoided by checking the return value of ext4fs_dirhash and propagating the error,
similar to how it's done with ext4_htree_store_dirent

[...]

Applied, thanks!

[1/1] Fix uninitialized variable in ext4_inlinedir_to_tree

      commit: 8dc9c3da79c84b13fdb135e2fb0a149a8175bffe

Best regards,

Signature · 1 line
Theodore Ts'o <[email protected]>