summaryrefslogtreecommitdiff
path: root/drivers/virtio/virtio_pci_modern_dev.c
diff options
context:
space:
mode:
authorXuan Zhuo <xuanzhuo@linux.alibaba.com>2023-10-19 11:49:02 +0800
committerMichael S. Tsirkin <mst@redhat.com>2023-11-01 09:19:59 -0400
commite0592acd1ef2497b861ef7ed6eda14b092b1e667 (patch)
treeba4a09255d46d09b320943599ac73b56098cfd00 /drivers/virtio/virtio_pci_modern_dev.c
parentfafb51a67fb883eb2dde352539df939a251851be (diff)
virtio_pci: add check for common cfg size
Some buggy devices, the common cfg size may not match the features. This patch checks the common cfg size for the features(VIRTIO_F_NOTIF_CONFIG_DATA, VIRTIO_F_RING_RESET). When the common cfg size does not match the corresponding feature, we fail the probe and print error message. Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com> Acked-by: Jason Wang <jasowang@redhat.com> Message-Id: <20231019034902.7346-1-xuanzhuo@linux.alibaba.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/virtio/virtio_pci_modern_dev.c')
-rw-r--r--drivers/virtio/virtio_pci_modern_dev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/virtio/virtio_pci_modern_dev.c b/drivers/virtio/virtio_pci_modern_dev.c
index d312443d6569..e2a1fe7bb66c 100644
--- a/drivers/virtio/virtio_pci_modern_dev.c
+++ b/drivers/virtio/virtio_pci_modern_dev.c
@@ -296,7 +296,7 @@ int vp_modern_probe(struct virtio_pci_modern_device *mdev)
mdev->common = vp_modern_map_capability(mdev, common,
sizeof(struct virtio_pci_common_cfg), 4,
0, sizeof(struct virtio_pci_modern_common_cfg),
- NULL, NULL);
+ &mdev->common_len, NULL);
if (!mdev->common)
goto err_map_common;
mdev->isr = vp_modern_map_capability(mdev, isr, sizeof(u8), 1,