xfs: directory scrubber must walk through data block to offset
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 17 Jan 2018 02:54:12 +0000 (18:54 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Thu, 18 Jan 2018 05:00:46 +0000 (21:00 -0800)
commitce92d29ddf9908d397895c46b7c78e9db8df414d
treee05535b52a47a975f80995bca5e1260fd3248fa7
parent638a7174894c8f2195430990b614615ef16e3912
xfs: directory scrubber must walk through data block to offset

In xfs_scrub_dir_rec, we must walk through the directory block entries
to arrive at the offset given by the hash structure.  If we blindly
trust the hash address, we can end up midway into a directory entry and
stray outside the block.  Found by lastbit fuzzing lents[3].address in
xfs/390 with KASAN enabled.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/libxfs/xfs_dir2.h
fs/xfs/libxfs/xfs_dir2_data.c
fs/xfs/libxfs/xfs_dir2_sf.c
fs/xfs/scrub/dir.c
fs/xfs/xfs_dir2_readdir.c