fs/freevxfs: reject immed inode larger than the inline area
PATCH 1/1 fs/freevxfs: reject immed inode larger than the inline area
vxfs_immed_read_folio() copies a full PAGE_SIZE from the 96-byte inline immed area (vii_immed.vi_immed) without clamping to the inode size. An "immed" inode whose on-disk size exceeds 96 bytes therefore causes an out-of-bounds read of the vxfs_inode slab, and the bytes are returned to userspace by read() (KASAN: slab-out-of-bounds, read of size 4096), reachable from a mounted crafted VxFS image by read() of the file.
An immed inode stores its data inline and is always <= VXFS_NIMMED (96) bytes; reject at iget time any immed inode that claims a larger size.
Signed-off-by Marouane El Moufid <[email protected]>
--- fs/freevxfs/vxfs_inode.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/freevxfs/vxfs_inode.c +5 -0
@@ -268,6 +268,11 @@return ERR_PTR (error); } +if (VXFS_ISIMMED (vip) && ip->i_size >sizeof (vip->vii_immed.vi_immed)) { +iget_failed (ip); +return ERR_PTR (-EINVAL ); + } +if (VXFS_ISIMMED (vip)) aops = &vxfs_immed_aops;else
Christian Brauner
maintainerQuoted 1 line · Marouane El Moufid
[PATCH] fs/freevxfs: reject immed inode larger than the inline area
freevxfs was removed in v7.3.