From: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
To: anatoly.burakov@intel.com
Cc: dev@dpdk.org, deepak.k.jain@intel.com,
Kuba Kozak <kubax.kozak@intel.com>,
patrick@patrickmacarthur.net, stable@dpdk.org
Subject: [dpdk-stable] [PATCH v2] vfio: fix close unchecked file descriptor
Date: Thu, 21 Sep 2017 15:49:08 +0200 [thread overview]
Message-ID: <20170921134908.5076-1-michalx.k.jastrzebski@intel.com> (raw)
In-Reply-To: <1505901573-463-1-git-send-email-kubax.kozak@intel.com>
From: Kuba Kozak <kubax.kozak@intel.com>
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>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
v2:
Change check condition
---
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..537beeb 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 >= 0)
+ close(fd);
break;
case SOCKET_REQ_GROUP:
/* wait for group number */
--
2.7.4
next prev parent reply other threads:[~2017-09-21 13:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-20 9:59 [dpdk-stable] [PATCH] " 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 ` Michal Jastrzebski [this message]
2017-09-21 16:07 ` [dpdk-stable] [PATCH v2] " Patrick MacArthur
2017-10-05 21:42 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170921134908.5076-1-michalx.k.jastrzebski@intel.com \
--to=michalx.k.jastrzebski@intel.com \
--cc=anatoly.burakov@intel.com \
--cc=deepak.k.jain@intel.com \
--cc=dev@dpdk.org \
--cc=kubax.kozak@intel.com \
--cc=patrick@patrickmacarthur.net \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).