Reserve vq->priv during reset. Prevent vp_modern_map_vq_notify() from being called repeatedly. Only set vq->priv = NULL in normal setup virtqueue, and keep vq->priv in the process of re-enable queue. Signed-off-by: Xuan Zhuo <xuanzhuo@xxxxxxxxxxxxxxxxx> --- drivers/virtio/virtio_pci_modern.c | 8 +++++--- drivers/virtio/virtio_ring.c | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c index 5af82948f0ae..bed3e9b84272 100644 --- a/drivers/virtio/virtio_pci_modern.c +++ b/drivers/virtio/virtio_pci_modern.c @@ -224,10 +224,12 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev, virtqueue_get_avail_addr(vq), virtqueue_get_used_addr(vq)); - vq->priv = (void __force *)vp_modern_map_vq_notify(mdev, index, NULL); if (!vq->priv) { - err = -ENOMEM; - goto err_map_notify; + vq->priv = (void __force *)vp_modern_map_vq_notify(mdev, index, NULL); + if (!vq->priv) { + err = -ENOMEM; + goto err_map_notify; + } } if (msix_vec != VIRTIO_MSI_NO_VECTOR) { diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index b37753bdbbc4..6a892c8ea16e 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -1723,6 +1723,7 @@ static struct virtqueue *vring_create_virtqueue_packed( vq->vq.callback = callback; vq->vq.name = name; + vq->vq.priv = NULL; vq->indirect = virtio_has_feature(vdev, VIRTIO_RING_F_INDIRECT_DESC) && !context; } @@ -2211,6 +2212,7 @@ static int __vring_init_virtqueue(struct virtqueue *_vq, if (!reset) { vq->vq.callback = callback; vq->vq.name = name; + vq->vq.priv = NULL; vq->indirect = virtio_has_feature(vdev, VIRTIO_RING_F_INDIRECT_DESC) && !context; } -- 2.31.0 _______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization