[PATCH v2 04/12] bus/pci: reset VFIO device FD after release
David Marchand
david.marchand at redhat.com
Sat Oct 24 15:21:29 CEST 2026
From: Stephen Hemminger <stephen at networkplumber.org>
The VFIO device fd is closed by dev_vfio_release_device() but is left
in the interrupt handle, so freeing the handle on cleanup logs a bogus
FD leak warning.
Mark dev_fd invalid after release.
In secondary process the request handle is unused and does not have to
be set in the first place.
Fixes: d770ee9caed0 ("interrupts: warn on leaked FDs")
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Signed-off-by: David Marchand <david.marchand at redhat.com>
---
drivers/bus/pci/linux/pci_vfio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index fb35bc1d49..c81d20200d 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -998,8 +998,6 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)
/* we need save vfio_dev_fd, so it can be used during release */
if (rte_intr_dev_fd_set(dev->intr_handle, vfio_dev_fd))
goto err_map;
- if (rte_intr_dev_fd_set(dev->vfio_req_intr_handle, vfio_dev_fd))
- goto err_map;
return 0;
err_map:
@@ -1103,6 +1101,7 @@ pci_vfio_unmap_resource_primary(struct rte_pci_device *dev)
PCI_LOG(ERR, "Cannot release VFIO device");
return ret;
}
+ rte_intr_dev_fd_set(dev->intr_handle, -1);
vfio_res_list =
RTE_TAILQ_CAST(dev_vfio_tailq.head, mapped_pci_res_list);
@@ -1142,6 +1141,7 @@ pci_vfio_unmap_resource_secondary(struct rte_pci_device *dev)
PCI_LOG(ERR, "Cannot release VFIO device");
return ret;
}
+ rte_intr_dev_fd_set(dev->intr_handle, -1);
vfio_res_list =
RTE_TAILQ_CAST(dev_vfio_tailq.head, mapped_pci_res_list);
--
2.54.0
More information about the dev
mailing list