mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 03:27:30 -04:00
ocfs2: validate inline xattr header before ibody remove
[BUG] A corrupt inline xattr header can make ocfs2_xattr_ibody_remove() pass an unchecked header into ocfs2_remove_value_outside() during inode xattr teardown. [CAUSE] ocfs2_xattr_ibody_remove() still rebuilt the ibody xattr header directly from di->i_xattr_inline_size and then handed it to code that iterates xh_count and entry geometry. [FIX] Validate the inline xattr header with the shared helper before handing it to the outside-value removal path, and propagate -EFSCORRUPTED on bad metadata instead of traversing the unchecked header. Link: https://lore.kernel.org/20260508085914.61647-4-gality369@gmail.com Signed-off-by: ZhengYuan Huang <gality369@gmail.com> Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com> Cc: Changwei Ge <gechangwei@live.cn> Cc: Heming Zhao <heming.zhao@suse.com> Cc: Jia-Ju Bai <baijiaju1990@gmail.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Jun Piao <piaojun@huawei.com> Cc: Junxiao Bi <junxiao.bi@oracle.com> Cc: Mark Fasheh <mark@fasheh.com> Cc: Zixuan Fu <r33s3n6@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
a61b83dd83
commit
b8ba8bbe69
@@ -2476,9 +2476,9 @@ static int ocfs2_xattr_ibody_remove(struct inode *inode,
|
||||
.vb_access = ocfs2_journal_access_di,
|
||||
};
|
||||
|
||||
header = (struct ocfs2_xattr_header *)
|
||||
((void *)di + inode->i_sb->s_blocksize -
|
||||
le16_to_cpu(di->i_xattr_inline_size));
|
||||
ret = ocfs2_xattr_ibody_lookup_header(inode, di, &header);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = ocfs2_remove_value_outside(inode, &vb, header,
|
||||
ref_ci, ref_root_bh);
|
||||
|
||||
Reference in New Issue
Block a user