xfs: catch invalid negative blknos in _xfs_buf_find()
authorEric Sandeen <sandeen@redhat.com>
Fri, 28 Nov 2014 03:03:55 +0000 (14:03 +1100)
committerDave Chinner <david@fromorbit.com>
Fri, 28 Nov 2014 03:03:55 +0000 (14:03 +1100)
Here blkno is a daddr_t, which is a __s64; it's possible to hold
a value which is negative, and thus pass the (blkno >= eofs)
test.  Then we try to do a xfs_perag_get() for a ridiculous
agno via xfs_daddr_to_agno(), and bad things happen when that
fails, and returns a null pag which is dereferenced shortly
thereafter.

Found via a user-supplied fuzzed image...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_buf.c

Simple merge