Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ext4: xattr: fix null pointer deref in ext4_raw_inode()

If ext4_get_inode_loc() fails (e.g. if it returns -EFSCORRUPTED),
iloc.bh will remain set to NULL. Since ext4_xattr_inode_dec_ref_all()
lacks error checking, this will lead to a null pointer dereference
in ext4_raw_inode(), called right after ext4_get_inode_loc().

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: c8e008b60492 ("ext4: ignore xattrs past end")
Cc: stable@kernel.org
Signed-off-by: Karina Yankevich <k.yankevich@omp.ru>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Reviewed-by: Baokun Li <libaokun1@huawei.com>
Message-ID: <20251022093253.3546296-1-k.yankevich@omp.ru>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>

authored by

Karina Yankevich and committed by
Theodore Ts'o
b97cb7d6 892e1cf1

+5 -1
+5 -1
fs/ext4/xattr.c
··· 1174 1174 if (block_csum) 1175 1175 end = (void *)bh->b_data + bh->b_size; 1176 1176 else { 1177 - ext4_get_inode_loc(parent, &iloc); 1177 + err = ext4_get_inode_loc(parent, &iloc); 1178 + if (err) { 1179 + EXT4_ERROR_INODE(parent, "parent inode loc (error %d)", err); 1180 + return; 1181 + } 1178 1182 end = (void *)ext4_raw_inode(&iloc) + EXT4_SB(parent->i_sb)->s_inode_size; 1179 1183 } 1180 1184