patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v3 1/2] eal/bsd: fix possible IOPL fd leak
       [not found]   ` <CGME20181123153947eucas1p169a2b7cec02b2edd7258aef11b1c1e2e@eucas1p1.samsung.com>
@ 2018-11-23 15:39     ` Ilya Maximets
  2018-11-23 17:32       ` Maxime Coquelin
  0 siblings, 1 reply; 2+ messages in thread
From: Ilya Maximets @ 2018-11-23 15:39 UTC (permalink / raw)
  To: dev, David Marchand
  Cc: Maxime Coquelin, Tiwei Bie, Zhihong Wang, Thomas Monjalon,
	Ferruh Yigit, Ian Stokes, Kevin Traynor, Bruce Richardson,
	Ilya Maximets, stable

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

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

* Re: [dpdk-stable] [PATCH v3 1/2] eal/bsd: fix possible IOPL fd leak
  2018-11-23 15:39     ` [dpdk-stable] [PATCH v3 1/2] eal/bsd: fix possible IOPL fd leak Ilya Maximets
@ 2018-11-23 17:32       ` Maxime Coquelin
  0 siblings, 0 replies; 2+ messages in thread
From: Maxime Coquelin @ 2018-11-23 17:32 UTC (permalink / raw)
  To: Ilya Maximets, dev, David Marchand
  Cc: Tiwei Bie, Zhihong Wang, Thomas Monjalon, Ferruh Yigit,
	Ian Stokes, Kevin Traynor, Bruce Richardson, stable



On 11/23/18 4:39 PM, Ilya Maximets wrote:
> 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 */
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

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

end of thread, other threads:[~2018-11-23 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20181123143620.10480-1-i.maximets@samsung.com>
     [not found] ` <20181123153920.12398-1-i.maximets@samsung.com>
     [not found]   ` <CGME20181123153947eucas1p169a2b7cec02b2edd7258aef11b1c1e2e@eucas1p1.samsung.com>
2018-11-23 15:39     ` [dpdk-stable] [PATCH v3 1/2] eal/bsd: fix possible IOPL fd leak Ilya Maximets
2018-11-23 17:32       ` Maxime Coquelin

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).