提交 28afea5b 编写于 作者: I Ian Campbell 提交者: Jens Axboe

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: NIan Campbell <ian.campbell@citrix.com>
Acked-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
上级 22ef37ee
...@@ -977,8 +977,10 @@ static void backend_changed(struct xenbus_device *dev, ...@@ -977,8 +977,10 @@ static void backend_changed(struct xenbus_device *dev,
break; break;
case XenbusStateClosing: case XenbusStateClosing:
if (info->gd == NULL) if (info->gd == NULL) {
xenbus_dev_fatal(dev, -ENODEV, "gd is NULL"); xenbus_frontend_closed(dev);
break;
}
bd = bdget_disk(info->gd, 0); bd = bdget_disk(info->gd, 0);
if (bd == NULL) if (bd == NULL)
xenbus_dev_fatal(dev, -ENODEV, "bdget failed"); xenbus_dev_fatal(dev, -ENODEV, "bdget failed");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册