Skip to content

Commit 28afea5

Browse files
Ian CampbellJens Axboe
authored andcommitted
xen/blkfront: allow xenbus state transition to Closing->Closed when not 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: [email protected] Signed-off-by: Ian Campbell <[email protected]> Acked-by: Jeremy Fitzhardinge <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 22ef37e commit 28afea5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/block/xen-blkfront.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -977,8 +977,10 @@ static void backend_changed(struct xenbus_device *dev,
977977
break;
978978

979979
case XenbusStateClosing:
980-
if (info->gd == NULL)
981-
xenbus_dev_fatal(dev, -ENODEV, "gd is NULL");
980+
if (info->gd == NULL) {
981+
xenbus_frontend_closed(dev);
982+
break;
983+
}
982984
bd = bdget_disk(info->gd, 0);
983985
if (bd == NULL)
984986
xenbus_dev_fatal(dev, -ENODEV, "bdget failed");

0 commit comments

Comments
 (0)