Skip to content

Commit 8dc9c3d

Browse files
xshen053tytso
authored andcommitted
ext4: 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 Signed-off-by: Xiaxi Shen <[email protected]> Reported-and-tested-by: [email protected] Closes: https://syzkaller.appspot.com/bug?extid=eaba5abe296837a640c0 Link: https://patch.msgid.link/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent be21073 commit 8dc9c3d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/ext4/inline.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,11 @@ int ext4_inlinedir_to_tree(struct file *dir_file,
14101410
hinfo->hash = EXT4_DIRENT_HASH(de);
14111411
hinfo->minor_hash = EXT4_DIRENT_MINOR_HASH(de);
14121412
} else {
1413-
ext4fs_dirhash(dir, de->name, de->name_len, hinfo);
1413+
err = ext4fs_dirhash(dir, de->name, de->name_len, hinfo);
1414+
if (err) {
1415+
ret = err;
1416+
goto out;
1417+
}
14141418
}
14151419
if ((hinfo->hash < start_hash) ||
14161420
((hinfo->hash == start_hash) &&

0 commit comments

Comments
 (0)