From: Kris Shannon Date: Mon, 2 Mar 2009 08:47:37 +0000 (+1100) Subject: Fix kernel NULL pointer dereference in xen-blkfront X-Git-Tag: v2.6.29-rc8~68^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a1a15ac5f9aeee521c048a88fc1aec848e623de7;p=profile%2Fcommon%2Fkernel-common.git 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. --- diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index b6c8ce2..8f90508 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, 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");