mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-11 20:05:22 +02:00
ext4: fix uninitialized variable in ext4_inlinedir_to_tree
[ Upstream commit 8dc9c3da79
]
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 <shenxiaxi26@gmail.com>
Reported-and-tested-by: syzbot+eaba5abe296837a640c0@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=eaba5abe296837a640c0
Link: https://patch.msgid.link/20240501033017.220000-1-shenxiaxi26@gmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
850304152d
commit
e7abdad660
|
@ -1411,7 +1411,11 @@ int ext4_inlinedir_to_tree(struct file *dir_file,
|
||||||
hinfo->hash = EXT4_DIRENT_HASH(de);
|
hinfo->hash = EXT4_DIRENT_HASH(de);
|
||||||
hinfo->minor_hash = EXT4_DIRENT_MINOR_HASH(de);
|
hinfo->minor_hash = EXT4_DIRENT_MINOR_HASH(de);
|
||||||
} else {
|
} 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) ||
|
if ((hinfo->hash < start_hash) ||
|
||||||
((hinfo->hash == start_hash) &&
|
((hinfo->hash == start_hash) &&
|
||||||
|
|
Loading…
Reference in New Issue
Block a user