Skip to content

Commit c13615f

Browse files
lulu-github-nameMichael Tokarev
authored andcommitted
virtio-pci: Fix the failure process in kvm_virtio_pci_vector_use_one()
In function kvm_virtio_pci_vector_use_one(), the function will only use the irqfd/vector for itself. Therefore, in the undo label, the failing process is incorrect. To fix this, we can just remove this label. Fixes: f9a09ca ("vhost: add support for configure interrupt") Cc: [email protected] Signed-off-by: Cindy Lu <[email protected]> Message-Id: <[email protected]> Reviewed-by: Peter Maydell <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> (cherry picked from commit a113d04) Signed-off-by: Michael Tokarev <[email protected]>
1 parent b4efc4c commit c13615f

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

hw/virtio/virtio-pci.c

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ static int kvm_virtio_pci_vector_use_one(VirtIOPCIProxy *proxy, int queue_no)
892892
}
893893
ret = kvm_virtio_pci_vq_vector_use(proxy, vector);
894894
if (ret < 0) {
895-
goto undo;
895+
return ret;
896896
}
897897
/*
898898
* If guest supports masking, set up irqfd now.
@@ -902,25 +902,11 @@ static int kvm_virtio_pci_vector_use_one(VirtIOPCIProxy *proxy, int queue_no)
902902
ret = kvm_virtio_pci_irqfd_use(proxy, n, vector);
903903
if (ret < 0) {
904904
kvm_virtio_pci_vq_vector_release(proxy, vector);
905-
goto undo;
905+
return ret;
906906
}
907907
}
908908

909909
return 0;
910-
undo:
911-
912-
vector = virtio_queue_vector(vdev, queue_no);
913-
if (vector >= msix_nr_vectors_allocated(dev)) {
914-
return ret;
915-
}
916-
if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
917-
ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector);
918-
if (ret < 0) {
919-
return ret;
920-
}
921-
kvm_virtio_pci_irqfd_release(proxy, n, vector);
922-
}
923-
return ret;
924910
}
925911
static int kvm_virtio_pci_vector_vq_use(VirtIOPCIProxy *proxy, int nvqs)
926912
{

0 commit comments

Comments
 (0)