Skip to content

Commit

Permalink
xen/blkfront: allow xenbus state transition to Closing->Closed when n…
Browse files Browse the repository at this point in the history
…ot Connected

This situation can occur when attempting to attach a block device whose
backend is an empty physical CD-ROM driver. The backend in this case
will go directly from the Initialising state to Closing->Closed.
Previously this would result in a NULL pointer deref on info->gd
(xenbus_dev_fatal does not return as a1a15ac seems to expect)

Cc: stable@kernel.org
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
Ian Campbell authored and Jens Axboe committed May 19, 2009
1 parent 22ef37e commit 28afea5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/block/xen-blkfront.c
Original file line number Diff line number Diff line change
Expand Up @@ -977,8 +977,10 @@ static void backend_changed(struct xenbus_device *dev,
break;

case XenbusStateClosing:
if (info->gd == NULL)
xenbus_dev_fatal(dev, -ENODEV, "gd is NULL");
if (info->gd == NULL) {
xenbus_frontend_closed(dev);
break;
}
bd = bdget_disk(info->gd, 0);
if (bd == NULL)
xenbus_dev_fatal(dev, -ENODEV, "bdget failed");
Expand Down

0 comments on commit 28afea5

Please sign in to comment.