xfs: verify inline directory data forks
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 15 Mar 2017 07:24:25 +0000 (00:24 -0700)
committerRaspbian kernel package updater <root@raspbian.org>
Sun, 23 Jul 2017 02:53:18 +0000 (02:53 +0000)
commit98a1e3625d7d9485700ffb172d28f014f95e6ace
tree85133f4b048ecdff2d2ad512375a6e90d095bfc5
parent6cc6099b0e3dcaae898b4a5b3b249ad77a9a3bf4
xfs: verify inline directory data forks

commit 630a04e79dd41ff746b545d4fc052e0abb836120 upstream.

When we're reading or writing the data fork of an inline directory,
check the contents to make sure we're not overflowing buffers or eating
garbage data.  xfs/348 corrupts an inline symlink into an inline
directory, triggering a buffer overflow bug.

v2: add more checks consistent with _dir2_sf_check and make the verifier
usable from anywhere.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/libxfs/xfs_dir2_priv.h
fs/xfs/libxfs/xfs_dir2_sf.c
fs/xfs/libxfs/xfs_inode_fork.c
fs/xfs/libxfs/xfs_inode_fork.h
fs/xfs/xfs_dir2_readdir.c
fs/xfs/xfs_inode.c