[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 03/88] vhost-vdpa: check vhost_vdpa_set_vring_ready() return va
From: |
Michael S. Tsirkin |
Subject: |
[PULL v2 03/88] vhost-vdpa: check vhost_vdpa_set_vring_ready() return value |
Date: |
Tue, 2 Jul 2024 16:15:14 -0400 |
From: Stefano Garzarella <sgarzare@redhat.com>
vhost_vdpa_set_vring_ready() could already fail, but if Linux's
patch [1] will be merged, it may fail with more chance if
userspace does not activate virtqueues before DRIVER_OK when
VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK is not negotiated.
So better check its return value anyway.
[1]
https://lore.kernel.org/virtualization/20240206145154.118044-1-sgarzare@redhat.com/T/#u
Acked-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20240322092315.31885-1-sgarzare@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
net/vhost-vdpa.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 85e73dd6a7..eda714d1a4 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -399,7 +399,10 @@ static int vhost_vdpa_net_data_load(NetClientState *nc)
}
for (int i = 0; i < v->dev->nvqs; ++i) {
- vhost_vdpa_set_vring_ready(v, i + v->dev->vq_index);
+ int ret = vhost_vdpa_set_vring_ready(v, i + v->dev->vq_index);
+ if (ret < 0) {
+ return ret;
+ }
}
return 0;
}
@@ -1238,7 +1241,10 @@ static int vhost_vdpa_net_cvq_load(NetClientState *nc)
assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_VDPA);
- vhost_vdpa_set_vring_ready(v, v->dev->vq_index);
+ r = vhost_vdpa_set_vring_ready(v, v->dev->vq_index);
+ if (unlikely(r < 0)) {
+ return r;
+ }
if (v->shadow_vqs_enabled) {
n = VIRTIO_NET(v->dev->vdev);
@@ -1277,7 +1283,10 @@ static int vhost_vdpa_net_cvq_load(NetClientState *nc)
}
for (int i = 0; i < v->dev->vq_index; ++i) {
- vhost_vdpa_set_vring_ready(v, i);
+ r = vhost_vdpa_set_vring_ready(v, i);
+ if (unlikely(r < 0)) {
+ return r;
+ }
}
return 0;
--
MST
- [PULL v2 00/88] virtio: features,fixes, Michael S. Tsirkin, 2024/07/02
- [PULL v2 01/88] vhost: dirty log should be per backend type, Michael S. Tsirkin, 2024/07/02
- [PULL v2 02/88] vhost: Perform memory section dirty scans once per iteration, Michael S. Tsirkin, 2024/07/02
- [PULL v2 03/88] vhost-vdpa: check vhost_vdpa_set_vring_ready() return value,
Michael S. Tsirkin <=
- [PULL v2 04/88] virtio/virtio-pci: Handle extra notification data, Michael S. Tsirkin, 2024/07/02
- [PULL v2 09/88] Fix vhost user assertion when sending more than one fd, Michael S. Tsirkin, 2024/07/02
- [PULL v2 12/88] virtio-pci: only reset pm state during resetting, Michael S. Tsirkin, 2024/07/02
- [PULL v2 05/88] virtio: Prevent creation of device using notification-data with ioeventfd, Michael S. Tsirkin, 2024/07/02
- [PULL v2 06/88] virtio-mmio: Handle extra notification data, Michael S. Tsirkin, 2024/07/02
- [PULL v2 10/88] vhost-vsock: add VIRTIO_F_RING_PACKED to feature_bits, Michael S. Tsirkin, 2024/07/02
- [PULL v2 08/88] vhost/vhost-user: Add VIRTIO_F_NOTIFICATION_DATA to vhost feature bits, Michael S. Tsirkin, 2024/07/02
- [PULL v2 11/88] hw/virtio: Fix obtain the buffer id from the last descriptor, Michael S. Tsirkin, 2024/07/02
- [PULL v2 15/88] vhost-user: fix lost reconnect again, Michael S. Tsirkin, 2024/07/02
- [PULL v2 16/88] hw/cxl/mailbox: change CCI cmd set structure to be a member, not a reference, Michael S. Tsirkin, 2024/07/02