]> www.infradead.org Git - users/hch/xfsprogs.git/commit
xfs: don't crash if reading a directory results in an unexpected hole
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 10 Jan 2017 02:18:49 +0000 (20:18 -0600)
committerEric Sandeen <sandeen@redhat.com>
Tue, 10 Jan 2017 02:18:49 +0000 (20:18 -0600)
commit5f48ab17bffc8ec4ac4425ca75530b80984e399f
treea5d0464beb4f6f6d9c915c856739b0acbbd36e66
parent43a48f639d1684a895131b0b401878817f2ac320
xfs: don't crash if reading a directory results in an unexpected hole

Source kernel commit: 96a3aefb8ffde23180130460b0b2407b328eb727

In xfs_dir3_data_read, we can encounter the situation where err == 0 and
*bpp == NULL if the given bno offset happens to be a hole; this leads to
a crash if we try to set the buffer type after the _da_read_buf call.
Holes can happen due to corrupt or malicious entries in the bmbt data,
so be a little more careful when we're handling buffers.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_dir2_data.c