Skip to content

Commit

Permalink
Fix kernel NULL pointer dereference in xen-blkfront
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Kris Shannon authored and Jens Axboe committed Mar 5, 2009
1 parent 559595a commit a1a15ac
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/block/xen-blkfront.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit a1a15ac

Please sign in to comment.