[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1249329808.7686.26.camel@logos>
Date:	Mon, 03 Aug 2009 17:03:28 -0300
From:	Ramon de Carvalho Valle <ramon@...esecurity.org>
To:	linux-kernel@...r.kernel.org
Cc:	xfs@....sgi.com, hch@....de, mszeredi@...ell.com
Subject: [PATCH 1/1] XFS: __xfs_get_blocks check pointer to the target
 device
The __xfs_get_blocks function does not check if the pointer to the target
device is valid before dereferencing it.
Signed-off-by: Ramon de Carvalho Valle <ramon@...esecurity.org>
Cc: stable <stable@...nel.org>
---
 fs/xfs/linux-2.6/xfs_aops.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index aecf251..bf482d5 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -1419,7 +1419,11 @@ __xfs_get_blocks(
 	 * If this is a realtime file, data may be on a different device.
 	 * to that pointed to from the buffer_head b_bdev currently.
 	 */
-	bh_result->b_bdev = iomap.iomap_target->bt_bdev;
+	if (!iomap.iomap_target)
+		return -XFS_ERROR(EIO);
+
+	if (iomap.iomap_flags & IOMAP_REALTIME)
+		bh_result->b_bdev = iomap.iomap_target->bt_bdev;
 
 	/*
 	 * If we previously allocated a block out beyond eof and we are now
-- 
1.5.6.3
Download attachment "signature.asc" of type "application/pgp-signature" (198 bytes)
Powered by blists - more mailing lists
 
