[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.2.9 32/45] vhost-user: fix shared object return values
From: |
Michael Tokarev |
Subject: |
[Stable-8.2.9 32/45] vhost-user: fix shared object return values |
Date: |
Mon, 27 Jan 2025 23:26:13 +0300 |
VHOST_USER_BACKEND_SHARED_OBJECT_ADD and
VHOST_USER_BACKEND_SHARED_OBJECT_REMOVE state
in the spec that they return 0 for successful
operations, non-zero otherwise. However,
implementation relies on the return types
of the virtio-dmabuf library, with opposite
semantics (true if everything is correct,
false otherwise). Therefore, current
implementation violates the specification.
Revert the logic so that the implementation
of the vhost-user handling methods matches
the specification.
Fixes: 043e127a126bb3ceb5fc753deee27d261fd0c5ce
Fixes: 160947666276c5b7f6bca4d746bcac2966635d79
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Albert Esteve <aesteve@redhat.com>
Message-Id: <20241022124615.585596-1-aesteve@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit eea5aeef84e1b74f515b474d3a86377701f93750)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(Mjt: remove changes fixing v8.2.0-2279-g043e127a126b
"hw/virtio: check owner for removing objects")
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index f214df804b..7db7981841 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -1607,16 +1607,21 @@ vhost_user_backend_handle_shared_object_add(struct
vhost_dev *dev,
QemuUUID uuid;
memcpy(uuid.data, object->uuid, sizeof(object->uuid));
- return virtio_add_vhost_device(&uuid, dev);
+ return !virtio_add_vhost_device(&uuid, dev);
}
+/*
+ * Handle VHOST_USER_BACKEND_SHARED_OBJECT_REMOVE backend requests.
+ *
+ * Return: 0 on success, 1 on error.
+ */
static int
vhost_user_backend_handle_shared_object_remove(VhostUserShared *object)
{
QemuUUID uuid;
memcpy(uuid.data, object->uuid, sizeof(object->uuid));
- return virtio_remove_resource(&uuid);
+ return !virtio_remove_resource(&uuid);
}
static bool vhost_user_send_resp(QIOChannel *ioc, VhostUserHeader *hdr,
--
2.39.5
- [Stable-8.2.9 22/45] .gitlab-ci.d/cirrus: Drop support for macOS 13 (Ventura), (continued)
- [Stable-8.2.9 22/45] .gitlab-ci.d/cirrus: Drop support for macOS 13 (Ventura), Michael Tokarev, 2025/01/28
- [Stable-8.2.9 25/45] fuzz: specify audiodev for usb-audio, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 24/45] tcg/riscv: Fix StoreStore barrier generation, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 26/45] x86/loader: only patch linux kernels, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 27/45] edk2: get version + date from git submodule, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 28/45] edk2: commit version info, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 30/45] hw/intc/arm_gicv3_its: Zero initialize local DTEntry etc structs, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 29/45] roms: re-add edk2-basetools target, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 31/45] meson.build: Disallow libnfs v6 to fix the broken macOS build, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 33/45] s390x/s390-virtio-ccw: don't crash on weird RAM sizes, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 32/45] vhost-user: fix shared object return values,
Michael Tokarev <=
- [Stable-8.2.9 35/45] docs: Correct release of TCG trace-events removal, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 34/45] target/loongarch: Use actual operand size with vbsrl check, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 37/45] tests/qtest/boot-serial-test: Correct HPPA machine name, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 36/45] target/i386/cpu: Fix notes for CPU models, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 41/45] pci/msix: Fix msix pba read vector poll end calculation, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 38/45] backends/cryptodev-vhost-user: Fix local_error leaks, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 42/45] tests: acpi: whitelist expected blobs, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 39/45] hw/usb/hcd-xhci-pci: Use modulo to select MSI vector as per spec, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 45/45] hw/cxl: Fix msix_notify: Assertion `vector < dev->msix_entries_nr`, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 43/45] pci: acpi: Windows 'PCI Label Id' bug workaround, Michael Tokarev, 2025/01/28