aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2009-05-19 02:25:48 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-05-19 02:25:48 -0400
commit28afea5b2ffaa48f4f43d22ae8edcc384c05df80 (patch)
treea14c5275a701b1453447f3e7fa3a529ce08de994 /drivers
parent22ef37eed673587ac984965dc88ba94c68873291 (diff)
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 a1a15ac5 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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/xen-blkfront.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 8f905089b72b..6971a12e8b9b 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -977,8 +977,10 @@ 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) 980 if (info->gd == NULL) {
981 xenbus_dev_fatal(dev, -ENODEV, "gd is NULL"); 981 xenbus_frontend_closed(dev);
982 break;
983 }
982 bd = bdget_disk(info->gd, 0); 984 bd = bdget_disk(info->gd, 0);
983 if (bd == NULL) 985 if (bd == NULL)
984 xenbus_dev_fatal(dev, -ENODEV, "bdget failed"); 986 xenbus_dev_fatal(dev, -ENODEV, "bdget failed");