public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix kernel NULL pointer dereference in xen-blkfront
@ 2009-03-02  8:47 Kris Shannon
  2009-03-03 21:59 ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 3+ messages in thread
From: Kris Shannon @ 2009-03-02  8:47 UTC (permalink / raw)
  To: Linux Kernel List

When booting Xen Dom0 on a pre-release 3.2.1 hypervisor the system Oopses on a
"Unable to handle kernel NULL pointer dereference" in xenwatch.

>From the backtrace it looks like backend_changed is calling bdget_disk
with a NULL pointer.  Checking for NULL and returning ENODEV instead
allows the kernel to boot.
---
 drivers/block/xen-blkfront.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index f2fff5799ddf0fe1b41909b64d606d..3e2ab6d53adaeb70efa12f0a1f33bb 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -905,6 +905,8 @@ static void backend_changed(struct xenbus_device *dev,
 		break;

 	case XenbusStateClosing:
+		if (info->gd == NULL)
+			xenbus_dev_fatal(dev, -ENODEV, "gd is NULL");
 		bd = bdget_disk(info->gd, 0);
 		if (bd == NULL)
 			xenbus_dev_fatal(dev, -ENODEV, "bdget failed");
-- 
1.6.1.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-03-04 10:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-02  8:47 [PATCH] Fix kernel NULL pointer dereference in xen-blkfront Kris Shannon
2009-03-03 21:59 ` Jeremy Fitzhardinge
2009-03-04 10:16   ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox