From 511a4c74b8e94fd5990b222b207833290c5144b7 Mon Sep 17 00:00:00 2001 From: Yong Wang Date: Fri, 10 Feb 2017 08:53:17 -0500 Subject: [PATCH] pci: fix UIO interrupt file descriptor check before close The "dev->intr_handle.fd" is possibly a negative value while it is passed as an argument to function "close". Fix the check to the fd. Fixes: 5a60a7ffc801 ("pci: introduce functions to alloc and free uio resource") Signed-off-by: Yong Wang --- lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c index 3e4ffb57ee..20a4a665e3 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c @@ -230,7 +230,7 @@ pci_uio_free_resource(struct rte_pci_device *dev, close(dev->intr_handle.uio_cfg_fd); dev->intr_handle.uio_cfg_fd = -1; } - if (dev->intr_handle.fd) { + if (dev->intr_handle.fd >= 0) { close(dev->intr_handle.fd); dev->intr_handle.fd = -1; dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; -- 2.20.1