All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ramon de Carvalho Valle <ramon@risesecurity.org>
To: linux-kernel@vger.kernel.org
Cc: mszeredi@novell.com, hch@lst.de, xfs@oss.sgi.com
Subject: [PATCH 1/1] XFS: __xfs_get_blocks check pointer to the target device
Date: Mon, 03 Aug 2009 17:03:28 -0300	[thread overview]
Message-ID: <1249329808.7686.26.camel@logos> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 976 bytes --]

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@risesecurity.org>
Cc: stable <stable@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


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 121 bytes --]

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

WARNING: multiple messages have this Message-ID (diff)
From: Ramon de Carvalho Valle <ramon@risesecurity.org>
To: linux-kernel@vger.kernel.org
Cc: xfs@oss.sgi.com, hch@lst.de, mszeredi@novell.com
Subject: [PATCH 1/1] XFS: __xfs_get_blocks check pointer to the target device
Date: Mon, 03 Aug 2009 17:03:28 -0300	[thread overview]
Message-ID: <1249329808.7686.26.camel@logos> (raw)

[-- Attachment #1: Type: text/plain, Size: 976 bytes --]

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@risesecurity.org>
Cc: stable <stable@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


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

             reply	other threads:[~2009-08-03 20:01 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-03 20:03 Ramon de Carvalho Valle [this message]
2009-08-03 20:03 ` [PATCH 1/1] XFS: __xfs_get_blocks check pointer to the target device Ramon de Carvalho Valle
2009-08-03 21:49 ` Christoph Hellwig
2009-08-03 21:49   ` Christoph Hellwig
2009-08-04  2:00   ` Ramon de Carvalho Valle
2009-08-04  2:00     ` Ramon de Carvalho Valle
2009-08-04 14:31     ` Christoph Hellwig
2009-08-04 14:31       ` Christoph Hellwig
2009-08-04 16:25     ` Eric Sandeen
2009-08-04 16:25       ` Eric Sandeen
2009-08-04 18:50       ` Ramon de Carvalho Valle
2009-08-04 18:50         ` Ramon de Carvalho Valle
2009-08-04 18:51       ` [PATCH 1/1] XFS: xfs_iformat realtime device target pointer check Ramon de Carvalho Valle
2009-08-04 18:51         ` Ramon de Carvalho Valle
2009-08-04 19:11         ` Eric Sandeen
2009-08-04 19:11           ` Eric Sandeen
2009-08-05  3:55           ` Ramon de Carvalho Valle
2009-08-05  3:55             ` Ramon de Carvalho Valle
2009-08-05  4:15             ` Eric Sandeen
2009-08-05  4:15               ` Eric Sandeen
2009-08-05 13:21               ` Ramon de Carvalho Valle
2009-08-05 13:21                 ` Ramon de Carvalho Valle
2009-08-05 21:53               ` Felix Blyakher
2009-08-05 21:53                 ` Felix Blyakher
2009-08-05 15:17         ` Christoph Hellwig
2009-08-05 15:17           ` Christoph Hellwig
2009-08-05 16:34           ` Ramon de Carvalho Valle
2009-08-05 16:34             ` Ramon de Carvalho Valle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1249329808.7686.26.camel@logos \
    --to=ramon@risesecurity.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mszeredi@novell.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.