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>
Sat, 22 Apr 2017 05:15:05 +0000 (07:15 +0200)
commit0f27d9dcfe8fde07cb39b81eacf7f733c7b1df47
tree4084c46ec3b742c03dd8a2ecdb4fdd3418b0cfd7
parent230a372ff7316c9a22619257c1ad8974cb96daa5
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/libxfs/xfs_inode_buf.c