Commit c5e1af0f authored by Thadeu Lima de Souza Cascardo's avatar Thadeu Lima de Souza Cascardo Committed by Baokun Li
Browse files

ext4: explicitly exit when ext4_find_inline_entry returns an error

mainline inclusion
from mainline-v6.12-rc1
commit 51e14e78b5fb3e6f839393cd2d34386ee7b69af3
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAYPK6
CVE: CVE-2024-47701

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=51e14e78b5fb3e6f839393cd2d34386ee7b69af3



--------------------------------

__ext4_find_entry currently ignores the return of ext4_find_inline_entry,
except for returning the bh or NULL when has_inline_data is 1.

Even though has_inline_data is set to 1 before calling
ext4_find_inline_entry and would only be set to 0 when that function
returns NULL, check for an encoded error return explicitly in order to
exit.

That makes the code more readable, not requiring that one assumes the cases
when has_inline_data is 1.

Signed-off-by: default avatarThadeu Lima de Souza Cascardo <cascardo@igalia.com>
Link: https://patch.msgid.link/20240821152324.3621860-4-cascardo@igalia.com


Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
parent c12900a4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1618,7 +1618,7 @@ static struct buffer_head *__ext4_find_entry(struct inode *dir,
					     &has_inline_data);
		if (inlined)
			*inlined = has_inline_data;
		if (has_inline_data)
		if (has_inline_data || IS_ERR(ret))
			goto cleanup_and_exit;
	}