xfs: don't allow di_size with high bit set
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 5 Dec 2016 01:38:38 +0000 (12:38 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Mar 2017 07:35:18 +0000 (09:35 +0200)
commitc4cf86f69597d4547a736e3edd5b88ae61b68fa2
tree3934f40cfd2bf48b77ee30a4498f936273c06d5a
parent48da8f817b9db7909e5758257bdc84a6c611d99a
xfs: don't allow di_size with high bit set

commit ef388e2054feedaeb05399ed654bdb06f385d294 upstream.

The on-disk field di_size is used to set i_size, which is a signed
integer of loff_t.  If the high bit of di_size is set, we'll end up with
a negative i_size, which will cause all sorts of problems.  Since the
VFS won't let us create a file with such length, we should catch them
here in the verifier too.

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>
Cc: Nikolay Borisov <n.borisov.lkml@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/libxfs/xfs_inode_buf.c