aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorKris Shannon <kris@shannon.id.au>2009-03-02 03:47:37 -0500
committerJens Axboe <jens.axboe@oracle.com>2009-03-05 06:04:57 -0500
commita1a15ac5f9aeee521c048a88fc1aec848e623de7 (patch)
tree964c1fe343bbc8edc24003df15dd475f1255e7e5 /drivers/block
parent559595a985e106d2fa9f0c79b7f5805453fed593 (diff)
Fix kernel NULL pointer dereference in xen-blkfront
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.
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/xen-blkfront.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index b6c8ce254359..8f905089b72b 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -977,6 +977,8 @@ static void backend_changed(struct xenbus_device *dev,
977 break; 977 break;
978 978
979 case XenbusStateClosing: 979 case XenbusStateClosing:
980 if (info->gd == NULL)
981 xenbus_dev_fatal(dev, -ENODEV, "gd is NULL");
980 bd = bdget_disk(info->gd, 0); 982 bd = bdget_disk(info->gd, 0);
981 if (bd == NULL) 983 if (bd == NULL)
982 xenbus_dev_fatal(dev, -ENODEV, "bdget failed"); 984 xenbus_dev_fatal(dev, -ENODEV, "bdget failed");