]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: sanity-check the unused space before trying to use it
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 18 Apr 2018 19:46:07 +0000 (14:46 -0500)
committerEric Sandeen <sandeen@redhat.com>
Wed, 18 Apr 2018 19:46:07 +0000 (14:46 -0500)
commit15348e044acf73e93ef04800e3376b3398a41a33
treeaeb0b98a49771aead920490e3f72aa720cbb5405
parent8dbee8f588b99072db585b413c4d883988fb5627
xfs: sanity-check the unused space before trying to use it

Source kernel commit: 6915ef35c0350e87a104cb4c4ab2121c81ca7a34

In xfs_dir2_data_use_free, we examine on-disk metadata and ASSERT if
it doesn't make sense.  Since a carefully crafted fuzzed image can cause
the kernel to crash after blowing a bunch of assertions, let's move
those checks into a validator function and rig everything up to return
EFSCORRUPTED to userspace.  Found by lastbit fuzzing ltail.bestcount via
xfs/391.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
libxfs/libxfs_priv.h
libxfs/xfs_dir2.h
libxfs/xfs_dir2_block.c
libxfs/xfs_dir2_data.c
libxfs/xfs_dir2_leaf.c
libxfs/xfs_dir2_node.c