patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Ilya Maximets <i.maximets@samsung.com>,
	dev@dpdk.org, David Marchand <david.marchand@redhat.com>
Cc: 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>,
	stable@dpdk.org
Subject: Re: [dpdk-stable] [PATCH v3 1/2] eal/bsd: fix possible IOPL fd leak
Date: Fri, 23 Nov 2018 18:32:56 +0100	[thread overview]
Message-ID: <26d4125a-17e6-0a6e-3e01-f0b66d289609@redhat.com> (raw)
In-Reply-To: <20181123153920.12398-2-i.maximets@samsung.com>



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>

      reply	other threads:[~2018-11-23 17:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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     ` Ilya Maximets
2018-11-23 17:32       ` Maxime Coquelin [this message]

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=26d4125a-17e6-0a6e-3e01-f0b66d289609@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=i.maximets@samsung.com \
    --cc=ian.stokes@intel.com \
    --cc=ktraynor@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).