aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2014-11-27 22:03:55 -0500
committerDave Chinner <david@fromorbit.com>2014-11-27 22:03:55 -0500
commitdb52d09ecbf85c54e263a9d1ebfb615a9b2b3ba6 (patch)
tree7c7ede18b9f3531f1831019a79e9c6dfa6edc83e /fs
parent91ee575f2b35d1307412f917787195c2f6a38dfb (diff)
xfs: catch invalid negative blknos in _xfs_buf_find()
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_buf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index c06d790a3000..d083889535a2 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -461,7 +461,7 @@ _xfs_buf_find(
461 * have to check that the buffer falls within the filesystem bounds. 461 * have to check that the buffer falls within the filesystem bounds.
462 */ 462 */
463 eofs = XFS_FSB_TO_BB(btp->bt_mount, btp->bt_mount->m_sb.sb_dblocks); 463 eofs = XFS_FSB_TO_BB(btp->bt_mount, btp->bt_mount->m_sb.sb_dblocks);
464 if (blkno >= eofs) { 464 if (blkno < 0 || blkno >= eofs) {
465 /* 465 /*
466 * XXX (dgc): we should really be returning -EFSCORRUPTED here, 466 * XXX (dgc): we should really be returning -EFSCORRUPTED here,
467 * but none of the higher level infrastructure supports 467 * but none of the higher level infrastructure supports