[PATCH] virtio: fix the bug of reading queue msix vector

11 views
Skip to first unread message

Waldemar Kozaczuk

unread,
Dec 16, 2021, 10:36:10 PM12/16/21
to osv...@googlegroups.com, Waldemar Kozaczuk
This patch fixes a silly bug caused by wrong placement of closing
parentheses which led to reading word value at offset 0x1 instead of
intended COMMON_CFG_OFFSET_OF(queue_msix_vector).

This bug did not cause real damage but made some hypervisors like
Intel's cloud hypervisor show this kind of warning:

cloud-hypervisor: 55.151472ms: <vcpu0> WARN:virtio-devices/src/transport/pci_common_config.rs:169 -- invalid virtio register word read: 0x1

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>
---
drivers/virtio-pci-device.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/virtio-pci-device.cc b/drivers/virtio-pci-device.cc
index 297758fc..d5b1da9c 100644
--- a/drivers/virtio-pci-device.cc
+++ b/drivers/virtio-pci-device.cc
@@ -185,7 +185,7 @@ void virtio_modern_pci_device::setup_queue(vring *queue)
if (_dev->is_msix()) {
// Setup queue_id:entry_id 1:1 correlation...
_common_cfg->virtio_conf_writew(COMMON_CFG_OFFSET_OF(queue_msix_vector), queue_index);
- if (_common_cfg->virtio_conf_readw(COMMON_CFG_OFFSET_OF(queue_msix_vector) != queue_index)) {
+ if (_common_cfg->virtio_conf_readw(COMMON_CFG_OFFSET_OF(queue_msix_vector)) != queue_index) {
virtio_e("Setting MSIx entry for queue %d failed.", queue_index);
return;
}
--
2.31.1

Commit Bot

unread,
Dec 19, 2021, 3:09:31 PM12/19/21
to osv...@googlegroups.com, Waldemar Kozaczuk
From: Waldemar Kozaczuk <jwkoz...@gmail.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

virtio: fix the bug of reading queue msix vector

This patch fixes a silly bug caused by wrong placement of closing
parentheses which led to reading word value at offset 0x1 instead of
intended COMMON_CFG_OFFSET_OF(queue_msix_vector).

This bug did not cause real damage but made some hypervisors like
Intel's cloud hypervisor show this kind of warning:

cloud-hypervisor: 55.151472ms: <vcpu0> WARN:virtio-devices/src/transport/pci_common_config.rs:169 -- invalid virtio register word read: 0x1

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>
Message-Id: <20211217033600.14...@gmail.com>

---
diff --git a/drivers/virtio-pci-device.cc b/drivers/virtio-pci-device.cc
Reply all
Reply to author
Forward
0 new messages