]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ext4: ext4_search_dir should return a proper error
authorThadeu Lima de Souza Cascardo <cascardo@igalia.com>
Wed, 21 Aug 2024 15:23:21 +0000 (12:23 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Oct 2024 10:00:40 +0000 (12:00 +0200)
commit3e3f232a05204fbede50e5f7bd5f67e1fa604b5b
treecc307fdff2d9f5360effbbc387b22a6bf6c57846
parent6e39a21ee2b87b90e1d16684813cf4e9be9b5ef8
ext4: ext4_search_dir should return a proper error

[ Upstream commit cd69f8f9de280e331c9e6ff689ced0a688a9ce8f ]

ext4_search_dir currently returns -1 in case of a failure, while it returns
0 when the name is not found. In such failure cases, it should return an
error code instead.

This becomes even more important when ext4_find_inline_entry returns an
error code as well in the next commit.

-EFSCORRUPTED seems appropriate as such error code as these failures would
be caused by unexpected record lengths and is in line with other instances
of ext4_check_dir_entry failures.

In the case of ext4_dx_find_entry, the current use of ERR_BAD_DX_DIR was
left as is to reduce the risk of regressions.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
Link: https://patch.msgid.link/20240821152324.3621860-2-cascardo@igalia.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ext4/namei.c