mirror of
https://github.com/mii443/qemu.git
synced 2025-12-03 19:18:23 +00:00
vhost-user-blk: Make sure to set Error on realize failure
We have to set errp before jumping to virtio_err, otherwise the caller
(virtio_device_realize()) will take this as success and crash when it
later tries to access things that we've already freed in the error path.
Fixes: 77542d4314
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210429171316.162022-2-kwolf@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
@@ -447,7 +447,6 @@ static void vhost_user_blk_device_realize(DeviceState *dev, Error **errp)
|
|||||||
{
|
{
|
||||||
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
|
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
|
||||||
VHostUserBlk *s = VHOST_USER_BLK(vdev);
|
VHostUserBlk *s = VHOST_USER_BLK(vdev);
|
||||||
Error *err = NULL;
|
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
if (!s->chardev.chr) {
|
if (!s->chardev.chr) {
|
||||||
@@ -495,8 +494,7 @@ static void vhost_user_blk_device_realize(DeviceState *dev, Error **errp)
|
|||||||
NULL, true);
|
NULL, true);
|
||||||
|
|
||||||
reconnect:
|
reconnect:
|
||||||
if (qemu_chr_fe_wait_connected(&s->chardev, &err) < 0) {
|
if (qemu_chr_fe_wait_connected(&s->chardev, errp) < 0) {
|
||||||
error_report_err(err);
|
|
||||||
goto virtio_err;
|
goto virtio_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user