DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vfio: fix close unchecked file descriptor
@ 2017-09-20  9:59 Kuba Kozak
  2017-09-20 10:15 ` Burakov, Anatoly
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Kuba Kozak @ 2017-09-20  9:59 UTC (permalink / raw)
  To: anatoly.burakov; +Cc: dev, Kuba Kozak, patrick, stable

Add file descriptor value check before calling close() function.

Coverity issue: 141297
Fixes: 811b6b25060f ("vfio: fix file descriptor leak in multi-process")
Cc: patrick@patrickmacarthur.net
Cc: stable@dpdk.org

Signed-off-by: Kuba Kozak <kubax.kozak@intel.com>
---
 lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c b/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c
index 7e8095c..c04f548 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c
@@ -301,7 +301,8 @@ vfio_mp_sync_thread(void __rte_unused * arg)
 				vfio_mp_sync_send_request(conn_sock, SOCKET_ERR);
 			else
 				vfio_mp_sync_send_fd(conn_sock, fd);
-			close(fd);
+			if (fd != -1)
+				close(fd);
 			break;
 		case SOCKET_REQ_GROUP:
 			/* wait for group number */
-- 
2.7.4

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

end of thread, other threads:[~2017-10-05 21:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-20  9:59 [dpdk-dev] [PATCH] vfio: fix close unchecked file descriptor Kuba Kozak
2017-09-20 10:15 ` Burakov, Anatoly
2017-09-20 14:34 ` Patrick MacArthur
2017-09-20 14:39   ` Burakov, Anatoly
2017-09-21  2:28     ` Patrick MacArthur
2017-09-21  9:49       ` Kozak, KubaX
2017-09-21 13:49 ` [dpdk-dev] [PATCH v2] " Michal Jastrzebski
2017-09-21 16:07   ` Patrick MacArthur
2017-10-05 21:42     ` 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).