[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 08/21] hw/virtio: handle un-configured shutdown in virtio-pci
From: |
Alex Bennée |
Subject: |
[PATCH v3 08/21] hw/virtio: handle un-configured shutdown in virtio-pci |
Date: |
Tue, 26 Jul 2022 20:21:37 +0100 |
The assert() protecting against leakage is a little aggressive and
causes needless crashes if a device is shutdown without having been
configured. In this case no descriptors are lost because none have
been assigned.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
hw/virtio/virtio-pci.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 45327f0b31..5ce61f9b45 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -996,9 +996,14 @@ static int virtio_pci_set_guest_notifiers(DeviceState *d,
int nvqs, bool assign)
nvqs = MIN(nvqs, VIRTIO_QUEUE_MAX);
- /* When deassigning, pass a consistent nvqs value
- * to avoid leaking notifiers.
+ /*
+ * When deassigning, pass a consistent nvqs value to avoid leaking
+ * notifiers. But first check we've actually been configured, exit
+ * early if we haven't.
*/
+ if (!assign && !proxy->nvqs_with_notifiers) {
+ return 0;
+ }
assert(assign || nvqs == proxy->nvqs_with_notifiers);
proxy->nvqs_with_notifiers = nvqs;
--
2.30.2
- Re: [PATCH v3 03/21] hw/virtio: fix some coding style issues, (continued)
- [PATCH v3 15/21] tests/qtest: use qos_printf instead of g_test_message, Alex Bennée, 2022/07/26
- [PATCH v3 06/21] hw/virtio: incorporate backend features in features, Alex Bennée, 2022/07/26
- [PATCH v3 20/21] tests/qtest: add a get_features op to vhost-user-test, Alex Bennée, 2022/07/26
- [PATCH v3 04/21] hw/virtio: log potentially buggy guest drivers, Alex Bennée, 2022/07/26
- [PATCH v3 05/21] block/vhost-user-blk-server: don't expose VHOST_USER_F_PROTOCOL_FEATURES, Alex Bennée, 2022/07/26
- [PATCH v3 07/21] hw/virtio: gracefully handle unset vhost_dev vdev, Alex Bennée, 2022/07/26
- [PATCH v3 08/21] hw/virtio: handle un-configured shutdown in virtio-pci,
Alex Bennée <=
- [PATCH v3 09/21] hw/virtio: fix vhost_user_read tracepoint, Alex Bennée, 2022/07/26
- [PATCH v3 17/21] tests/qtest: plain g_assert for VHOST_USER_F_PROTOCOL_FEATURES, Alex Bennée, 2022/07/26
- [PATCH v3 21/21] tests/qtest: enable tests for virtio-gpio, Alex Bennée, 2022/07/26
- [PATCH v3 19/21] tests/qtest: implement stub for VHOST_USER_GET_CONFIG, Alex Bennée, 2022/07/26
- [PATCH v3 13/21] tests/qtest: pass stdout/stderr down to subtests, Alex Bennée, 2022/07/26
- [PATCH v3 16/21] tests/qtest: catch unhandled vhost-user messages, Alex Bennée, 2022/07/26
- [PATCH v3 12/21] hw/virtio: add vhost-user-gpio-pci boilerplate, Alex Bennée, 2022/07/26
- [PATCH v3 10/21] hw/virtio: add some vhost-user trace events, Alex Bennée, 2022/07/26