DPDK patches and discussions
 help / color / mirror / Atom feed
* Re: [dpdk-dev] [PATCH] eal/linux: fix fd check before close
  2017-02-10 13:53 [dpdk-dev] [PATCH] eal/linux: fix fd check before close Yong Wang
@ 2017-02-10 13:24 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2017-02-10 13:24 UTC (permalink / raw)
  To: Yong Wang; +Cc: dev, ferruh.yigit

2017-02-10 08:53, Yong Wang:
> 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.
> 
> Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>

pci: fix UIO interrupt file descriptor check before close

Fixes: 5a60a7ffc801 ("pci: introduce functions to alloc and free uio resource")

Applied, thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [dpdk-dev] [PATCH] eal/linux: fix fd check before close
@ 2017-02-10 13:53 Yong Wang
  2017-02-10 13:24 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Yong Wang @ 2017-02-10 13:53 UTC (permalink / raw)
  To: ferruh.yigit; +Cc: dev, Yong Wang

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.

Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
---
 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 3e4ffb5..20a4a66 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 @@
 		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;
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-10 13:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-10 13:53 [dpdk-dev] [PATCH] eal/linux: fix fd check before close Yong Wang
2017-02-10 13:24 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).