[PATCH v1 1/2] net/virtio: release Rx interrupt resources on reinit

Anatoly Burakov anatoly.burakov at intel.com
Thu Nov 19 17:34:28 CET 2026


Reinitializing a virtio device with Rx interrupts enabled can allocate
MSI-X eventfds twice. Before eventfd fix, this was leaking the original
descriptors, after the fix this has turned into failure when EAL rejects
the repeated enable.

Release the existing VFIO MSI-X interrupt resources before
reinitializing the device.

Fixes: 3ba6b689893f ("eal/linux: fix eventfd leaks when enabling interrupts")

Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
 drivers/net/virtio/virtio_ethdev.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index e6ad2de4baa..c595b8edcb2 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1864,6 +1864,15 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
 	struct virtio_net_config local_config;
 	int ret;
 
+	/* Release Rx interrupt resources left by a previous initialization. */
+	if (eth_dev->intr_handle != NULL &&
+			rte_intr_type_get(eth_dev->intr_handle) == RTE_INTR_HANDLE_VFIO_MSIX &&
+			rte_intr_nb_efd_get(eth_dev->intr_handle) > 0) {
+		virtio_intr_disable(eth_dev);
+		rte_intr_efd_disable(eth_dev->intr_handle);
+		rte_intr_vec_list_free(eth_dev->intr_handle);
+	}
+
 	/* Reset the device although not necessary at startup */
 	virtio_reset(hw);
 
-- 
2.52.0



More information about the dev mailing list