diff options
| author | Aldo Ariel Panzardo <qwe.aldo@gmail.com> | 2026-09-23 08:57:44 -0300 |
|---|---|---|
| committer | Carlos Maiolino <cem@kernel.org> | 2026-10-08 19:23:27 +0200 |
| commit | 9232301894a06e664d8de2da97175cf98419bd16 (patch) | |
| tree | 1f327bbe5fb9a7a83c2bd2f5cd6a36477026ebaf /tools/lib/python | |
| parent | 1d55a10278054fbebb9f571c99c32dac42327361 (diff) | |
| download | linux-next-9232301894a06e664d8de2da97175cf98419bd16.tar.gz linux-next-9232301894a06e664d8de2da97175cf98419bd16.zip | |
xfs: bound inode fork length against the fork size during log recovery
xlog_recover_inode_commit_pass2() copies an inode log item's data/attr
fork region into the inode buffer using the on-log region length without
bounding it against the fork capacity, e.g.:
len = item->ri_buf[2].iov_len;
memcpy(XFS_DFORK_DPTR(dip), src, len);
The only guard is an ASSERT, which is a no-op on production kernels
(CONFIG_XFS_DEBUG off), and xfs_dinode_verify() runs only after the copy.
A crafted image with a dirty log can therefore drive a heap out-of-bounds
write at mount time. The XFS_ILOG_DBROOT sibling already passes
XFS_DFORK_DSIZE as a bound; the DDATA/DEXT and ADATA/AEXT memcpy paths
did not.
Bound each logged fork region against the destination fork size before
copying it, and reject the log item with -EFSCORRUPTED when it does not
fit. Because the recovered inode is only verified after the fork data has
been copied in, the checks are done up front, before any memcpy into the
on-disk inode.
Fixes: 658fa68b6f34 ("xfs: refactor log recovery inode item dispatch for pass2 commit functions")
Cc: stable@vger.kernel.org # v5.8
Signed-off-by: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
