[RFC 1/4] bus/pci: fix check on interrupt FD for FreeBSD
David Marchand
david.marchand at redhat.com
Thu Jul 23 15:19:04 CEST 2026
A 0 file descriptor is valid. And a negative value is not.
Only close a positive file descriptor.
Fixes: 5a60a7ffc801 ("pci: introduce functions to alloc and free uio resource")
Signed-off-by: David Marchand <david.marchand at redhat.com>
---
drivers/bus/pci/bsd/pci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index c6df31d486..bbe08605af 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -93,7 +93,7 @@ pci_uio_free_resource(struct rte_pci_device *dev,
{
rte_free(uio_res);
- if (rte_intr_fd_get(dev->intr_handle)) {
+ if (rte_intr_fd_get(dev->intr_handle) >= 0) {
close(rte_intr_fd_get(dev->intr_handle));
rte_intr_fd_set(dev->intr_handle, -1);
rte_intr_type_set(dev->intr_handle, RTE_INTR_HANDLE_UNKNOWN);
--
2.54.0
More information about the dev
mailing list