[Top] [All Lists]

[PATCH 1/1] XFS: __xfs_get_blocks check pointer to the target device

To: linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH 1/1] XFS: __xfs_get_blocks check pointer to the target device
From: Ramon de Carvalho Valle <ramon@xxxxxxxxxxxxxxxx>
Date: Mon, 03 Aug 2009 17:03:28 -0300
Cc: xfs@xxxxxxxxxxx, hch@xxxxxx, mszeredi@xxxxxxxxxx
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@xxxxxxxxxxxxxxxx>
Cc: stable <stable@xxxxxxxxxx>
 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

Attachment: signature.asc
Description: This is a digitally signed message part

<Prev in Thread] Current Thread [Next in Thread>