mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
ext4: return error on ext4_find_inline_entry
[ Upstream commit 4d231b91a944f3cab355fce65af5871fb5d7735b ] In case of errors when reading an inode from disk or traversing inline directory entries, return an error-encoded ERR_PTR instead of returning NULL. ext4_find_inline_entry only caller, __ext4_find_entry already returns such encoded errors. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com> Link: https://patch.msgid.link/20240821152324.3621860-3-cascardo@igalia.com Signed-off-by: Theodore Ts'o <tytso@mit.edu> Stable-dep-of: c6b72f5d82b1 ("ext4: avoid OOB when system.data xattr changes underneath the filesystem") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e953cb3f6d
commit
f595035794
@@ -1698,8 +1698,9 @@ struct buffer_head *ext4_find_inline_entry(struct inode *dir,
|
|||||||
void *inline_start;
|
void *inline_start;
|
||||||
int inline_size;
|
int inline_size;
|
||||||
|
|
||||||
if (ext4_get_inode_loc(dir, &iloc))
|
ret = ext4_get_inode_loc(dir, &iloc);
|
||||||
return NULL;
|
if (ret)
|
||||||
|
return ERR_PTR(ret);
|
||||||
|
|
||||||
down_read(&EXT4_I(dir)->xattr_sem);
|
down_read(&EXT4_I(dir)->xattr_sem);
|
||||||
if (!ext4_has_inline_data(dir)) {
|
if (!ext4_has_inline_data(dir)) {
|
||||||
@@ -1730,7 +1731,10 @@ struct buffer_head *ext4_find_inline_entry(struct inode *dir,
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
brelse(iloc.bh);
|
brelse(iloc.bh);
|
||||||
iloc.bh = NULL;
|
if (ret < 0)
|
||||||
|
iloc.bh = ERR_PTR(ret);
|
||||||
|
else
|
||||||
|
iloc.bh = NULL;
|
||||||
out_find:
|
out_find:
|
||||||
up_read(&EXT4_I(dir)->xattr_sem);
|
up_read(&EXT4_I(dir)->xattr_sem);
|
||||||
return iloc.bh;
|
return iloc.bh;
|
||||||
|
|||||||
Reference in New Issue
Block a user