DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Xu, Rosen" <rosen.xu@intel.com>
To: Li Qiang <liq3ea@163.com>, "Zhang, Tianfei" <tianfei.zhang@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "liq3ea@gmail.com" <liq3ea@gmail.com>
Subject: Re: [dpdk-dev] [PATCH] drivers: ifpga_rawdev: fix fd leak in rte_fpga_do_pr
Date: Wed, 10 Apr 2019 10:23:44 +0000	[thread overview]
Message-ID: <0E78D399C70DA940A335608C6ED296D73A695C24@SHSMSX104.ccr.corp.intel.com> (raw)
Message-ID: <20190410102344.D4XtBDG76O6ikARqzX6SZ5G0VUCJeKodvHIhUHmZU3Q@z> (raw)
In-Reply-To: <20190409143221.16396-1-liq3ea@163.com>



> -----Original Message-----
> From: Li Qiang [mailto:liq3ea@163.com]
> Sent: Tuesday, April 09, 2019 22:32
> To: Xu, Rosen <rosen.xu@intel.com>; Zhang, Tianfei
> <tianfei.zhang@intel.com>
> Cc: dev@dpdk.org; liq3ea@gmail.com; Li Qiang <liq3ea@163.com>
> Subject: [PATCH] drivers: ifpga_rawdev: fix fd leak in rte_fpga_do_pr
> 
> In rte_fpga_do_pr() function, if 'stat' return error the 'file_fd' is never closed
> thus leading a fd leak. This patch avoids this.
> 
> Spotted by Coverity: CID 27441
> 
> Signed-off-by: Li Qiang <liq3ea@163.com>
> ---
>  drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> index da772d026..0dbb16ca6 100644
> --- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> +++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> @@ -244,7 +244,7 @@ rte_fpga_do_pr(struct rte_rawdev *rawdev, int
> port_id,
>  	if (ret) {
>  		IFPGA_RAWDEV_PMD_ERR("stat on bitstream file
> failed: %s\n",
>  				file_name);
> -		return -EINVAL;

Fill ret before goto close_fd.

> +		goto close_fd;
>  	}
>  	buffer_size = file_stat.st_size;
>  	IFPGA_RAWDEV_PMD_INFO("bitstream file size: %zu\n", buffer_size);
> --
> 2.17.1
> 


  parent reply	other threads:[~2019-04-10 10:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-09 14:32 Li Qiang
2019-04-09 14:32 ` Li Qiang
2019-04-10 10:23 ` Xu, Rosen [this message]
2019-04-10 10:23   ` Xu, Rosen

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=0E78D399C70DA940A335608C6ED296D73A695C24@SHSMSX104.ccr.corp.intel.com \
    --to=rosen.xu@intel.com \
    --cc=dev@dpdk.org \
    --cc=liq3ea@163.com \
    --cc=liq3ea@gmail.com \
    --cc=tianfei.zhang@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).