[PATCH 1/1] XFS: __xfs_get_blocks check pointer to the target device
Ramon de Carvalho Valle
ramon at risesecurity.org
Mon Aug 3 15:03:28 CDT 2009
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 at risesecurity.org>
Cc: stable <stable at kernel.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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://oss.sgi.com/pipermail/xfs/attachments/20090803/39f55b20/attachment.sig>
More information about the xfs
mailing list