[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] 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)

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
---
 drivers/block/xen-blkfront.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index aa0c94b..a6cbf7b 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,
                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");
-- 
1.5.6.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.