[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/14] vhost-user-blk: Make sure to set Error on realize failure
From: |
Kevin Wolf |
Subject: |
[PULL 09/14] vhost-user-blk: Make sure to set Error on realize failure |
Date: |
Fri, 14 May 2021 18:31:19 +0200 |
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: 77542d431491788d1e8e79d93ce10172ef207775
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>
---
hw/block/vhost-user-blk.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index f5e9682703..7c85248a7b 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -447,7 +447,6 @@ static void vhost_user_blk_device_realize(DeviceState *dev,
Error **errp)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VHostUserBlk *s = VHOST_USER_BLK(vdev);
- Error *err = NULL;
int i, ret;
if (!s->chardev.chr) {
@@ -495,8 +494,7 @@ static void vhost_user_blk_device_realize(DeviceState *dev,
Error **errp)
NULL, true);
reconnect:
- if (qemu_chr_fe_wait_connected(&s->chardev, &err) < 0) {
- error_report_err(err);
+ if (qemu_chr_fe_wait_connected(&s->chardev, errp) < 0) {
goto virtio_err;
}
--
2.30.2
- [PULL 02/14] block: Fix Transaction leak in bdrv_root_attach_child(), (continued)
- [PULL 02/14] block: Fix Transaction leak in bdrv_root_attach_child(), Kevin Wolf, 2021/05/14
- [PULL 04/14] qapi: spelling fix (addtional), Kevin Wolf, 2021/05/14
- [PULL 05/14] block/export: improve vu_blk_sect_range_ok(), Kevin Wolf, 2021/05/14
- [PULL 10/14] vhost-user-blk: Don't reconnect during initialisation, Kevin Wolf, 2021/05/14
- [PULL 06/14] test: new qTest case to test the vhost-user-blk-server, Kevin Wolf, 2021/05/14
- [PULL 13/14] virtio: Fail if iommu_platform is requested, but unsupported, Kevin Wolf, 2021/05/14
- [PULL 11/14] vhost-user-blk: Improve error reporting in realize, Kevin Wolf, 2021/05/14
- [PULL 14/14] vhost-user-blk: Check that num-queues is supported by backend, Kevin Wolf, 2021/05/14
- [PULL 08/14] vhost-user-blk-test: test discard/write zeroes invalid inputs, Kevin Wolf, 2021/05/14
- [PULL 09/14] vhost-user-blk: Make sure to set Error on realize failure,
Kevin Wolf <=
- [PULL 12/14] vhost-user-blk: Get more feature flags from vhost device, Kevin Wolf, 2021/05/14
- Re: [PULL 00/14] Block layer patches, Philippe Mathieu-Daudé, 2021/05/16