DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ilya Maximets <i.maximets@samsung.com>
To: dev@dpdk.org, David Marchand <david.marchand@redhat.com>
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>,
	Tiwei Bie <tiwei.bie@intel.com>,
	Zhihong Wang <zhihong.wang@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	Ferruh Yigit <ferruh.yigit@intel.com>,
	Ian Stokes <ian.stokes@intel.com>,
	Kevin Traynor <ktraynor@redhat.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	Ilya Maximets <i.maximets@samsung.com>,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH v3 1/2] eal/bsd: fix possible IOPL fd leak
Date: Fri, 23 Nov 2018 18:39:19 +0300	[thread overview]
Message-ID: <20181123153920.12398-2-i.maximets@samsung.com> (raw)
In-Reply-To: <20181123153920.12398-1-i.maximets@samsung.com>

If rte_eal_iopl_init() will be called more than once we'll leak
the file descriptor.

Fixes: b46fe31862ec ("eal/bsd: fix virtio on FreeBSD")
Cc: stable@dpdk.org

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
 lib/librte_eal/bsdapp/eal/eal.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 508cbc46f..b8152a75c 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -556,9 +556,11 @@ int rte_eal_has_hugepages(void)
 int
 rte_eal_iopl_init(void)
 {
-	static int fd;
+	static int fd = -1;
+
+	if (fd < 0)
+		fd = open("/dev/io", O_RDWR);
 
-	fd = open("/dev/io", O_RDWR);
 	if (fd < 0)
 		return -1;
 	/* keep fd open for iopl */
-- 
2.17.1

  parent reply	other threads:[~2018-11-23 15:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20181123141748eucas1p132a221972a87ec82b50d4a6c83bd9646@eucas1p1.samsung.com>
2018-11-23 14:17 ` [dpdk-dev] [PATCH] net/virtio: avoid annoying IOPL call related errors Ilya Maximets
     [not found]   ` <CGME20181123143625eucas1p1def3421fa13b5aec7204549932c75bb7@eucas1p1.samsung.com>
2018-11-23 14:36     ` [dpdk-dev] [PATCH v2] " Ilya Maximets
2018-11-23 15:02       ` David Marchand
     [not found]       ` <CGME20181123153936eucas1p13bfbe13fcda92de7760ac768fcab43c5@eucas1p1.samsung.com>
2018-11-23 15:39         ` [dpdk-dev] [PATCH v3 0/2] IOPL related fixes Ilya Maximets
     [not found]           ` <CGME20181123153947eucas1p169a2b7cec02b2edd7258aef11b1c1e2e@eucas1p1.samsung.com>
2018-11-23 15:39             ` Ilya Maximets [this message]
2018-11-23 17:32               ` [dpdk-dev] [PATCH v3 1/2] eal/bsd: fix possible IOPL fd leak Maxime Coquelin
     [not found]           ` <CGME20181123153951eucas1p1218331b7e51db8eae3073fa6a14f3bcd@eucas1p1.samsung.com>
2018-11-23 15:39             ` [dpdk-dev] [PATCH v3 2/2] net/virtio: avoid annoying IOPL call related errors Ilya Maximets
2018-11-23 17:34               ` Maxime Coquelin
2018-11-23 15:41           ` [dpdk-dev] [PATCH v3 0/2] IOPL related fixes Maxime Coquelin
2018-11-23 15:53             ` Ilya Maximets
2018-11-23 16:25               ` Maxime Coquelin
2018-11-23 20:07                 ` Kevin Traynor
2018-11-23 22:29                   ` Thomas Monjalon
2018-11-25 10:42                     ` Thomas Monjalon
2018-11-26  9:49                       ` Kevin Traynor
2018-11-27 14:05                       ` David Marchand
2018-11-23 17:15       ` [dpdk-dev] [PATCH v2] net/virtio: avoid annoying IOPL call related errors Timothy Redaelli

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=20181123153920.12398-2-i.maximets@samsung.com \
    --to=i.maximets@samsung.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=ian.stokes@intel.com \
    --cc=ktraynor@redhat.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=tiwei.bie@intel.com \
    --cc=zhihong.wang@intel.com \
    /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).