* [dpdk-dev] [PATCH v3] drivers: ifpga_rawdev: fix fd leak in rte_fpga_do_pr
@ 2019-04-16 7:52 Li Qiang
2019-04-16 7:52 ` Li Qiang
0 siblings, 1 reply; 6+ messages in thread
From: Li Qiang @ 2019-04-16 7:52 UTC (permalink / raw)
To: rosen.xu, tianfei.zhang; +Cc: dev, stable, liq3ea, Li Qiang
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.
Coverity issue: 279441
Fixes: ef1e8ede3da59e("raw/ifpga: add Intel FPGA bus rawdev driver")
Cc: stable@dpdk.org
Signed-off-by: Li Qiang <liq3ea@163.com>
---
Change since v2: add proper tags in commit message
drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
index da772d026..eff001b59 100644
--- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
+++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
@@ -244,7 +244,8 @@ 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;
+ ret = -EINVAL;
+ goto close_fd;
}
buffer_size = file_stat.st_size;
IFPGA_RAWDEV_PMD_INFO("bitstream file size: %zu\n", buffer_size);
--
2.19.1.3.ge56e4f7
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH v3] drivers: ifpga_rawdev: fix fd leak in rte_fpga_do_pr
2019-04-16 7:52 [dpdk-dev] [PATCH v3] drivers: ifpga_rawdev: fix fd leak in rte_fpga_do_pr Li Qiang
@ 2019-04-16 7:52 ` Li Qiang
0 siblings, 0 replies; 6+ messages in thread
From: Li Qiang @ 2019-04-16 7:52 UTC (permalink / raw)
To: rosen.xu, tianfei.zhang; +Cc: dev, stable, liq3ea, Li Qiang
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.
Coverity issue: 279441
Fixes: ef1e8ede3da59e("raw/ifpga: add Intel FPGA bus rawdev driver")
Cc: stable@dpdk.org
Signed-off-by: Li Qiang <liq3ea@163.com>
---
Change since v2: add proper tags in commit message
drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
index da772d026..eff001b59 100644
--- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
+++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
@@ -244,7 +244,8 @@ 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;
+ ret = -EINVAL;
+ goto close_fd;
}
buffer_size = file_stat.st_size;
IFPGA_RAWDEV_PMD_INFO("bitstream file size: %zu\n", buffer_size);
--
2.19.1.3.ge56e4f7
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH v3] drivers: ifpga_rawdev: fix fd leak in rte_fpga_do_pr
@ 2019-04-16 5:05 Li Qiang
2019-04-16 5:05 ` Li Qiang
2019-04-16 7:02 ` Xu, Rosen
0 siblings, 2 replies; 6+ messages in thread
From: Li Qiang @ 2019-04-16 5:05 UTC (permalink / raw)
To: rosen.xu, tianfei.zhang; +Cc: dev, stable, liq3ea, Li Qiang
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.
Coverity issue: 279441
Fixes: ef1e8ede3da59e("raw/ifpga: add Intel FPGA bus rawdev driver")
Cc: stable@dpdk.org
Signed-off-by: Li Qiang <liq3ea@163.com>
---
Change since v2: add proper tags in commit message
drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
index da772d026..eff001b59 100644
--- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
+++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
@@ -244,7 +244,8 @@ 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;
+ ret = -EINVAL;
+ goto close_fd;
}
buffer_size = file_stat.st_size;
IFPGA_RAWDEV_PMD_INFO("bitstream file size: %zu\n", buffer_size);
--
2.19.1.3.ge56e4f7
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH v3] drivers: ifpga_rawdev: fix fd leak in rte_fpga_do_pr
2019-04-16 5:05 Li Qiang
@ 2019-04-16 5:05 ` Li Qiang
2019-04-16 7:02 ` Xu, Rosen
1 sibling, 0 replies; 6+ messages in thread
From: Li Qiang @ 2019-04-16 5:05 UTC (permalink / raw)
To: rosen.xu, tianfei.zhang; +Cc: dev, stable, liq3ea, Li Qiang
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.
Coverity issue: 279441
Fixes: ef1e8ede3da59e("raw/ifpga: add Intel FPGA bus rawdev driver")
Cc: stable@dpdk.org
Signed-off-by: Li Qiang <liq3ea@163.com>
---
Change since v2: add proper tags in commit message
drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
index da772d026..eff001b59 100644
--- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
+++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
@@ -244,7 +244,8 @@ 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;
+ ret = -EINVAL;
+ goto close_fd;
}
buffer_size = file_stat.st_size;
IFPGA_RAWDEV_PMD_INFO("bitstream file size: %zu\n", buffer_size);
--
2.19.1.3.ge56e4f7
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH v3] drivers: ifpga_rawdev: fix fd leak in rte_fpga_do_pr
2019-04-16 5:05 Li Qiang
2019-04-16 5:05 ` Li Qiang
@ 2019-04-16 7:02 ` Xu, Rosen
2019-04-16 7:02 ` Xu, Rosen
1 sibling, 1 reply; 6+ messages in thread
From: Xu, Rosen @ 2019-04-16 7:02 UTC (permalink / raw)
To: Li Qiang, Zhang, Tianfei; +Cc: dev, stable, liq3ea
> -----Original Message-----
> From: Li Qiang [mailto:liq3ea@163.com]
> Sent: Tuesday, April 16, 2019 13:05
> To: Xu, Rosen <rosen.xu@intel.com>; Zhang, Tianfei
> <tianfei.zhang@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org; liq3ea@gmail.com; Li Qiang
> <liq3ea@163.com>
> Subject: [PATCH v3] 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.
>
> Coverity issue: 279441
> Fixes: ef1e8ede3da59e("raw/ifpga: add Intel FPGA bus rawdev driver")
> Cc: stable@dpdk.org
>
> Signed-off-by: Li Qiang <liq3ea@163.com>
> ---
> Change since v2: add proper tags in commit message
>
> drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> index da772d026..eff001b59 100644
> --- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> +++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> @@ -244,7 +244,8 @@ 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;
> + ret = -EINVAL;
> + goto close_fd;
> }
> buffer_size = file_stat.st_size;
> IFPGA_RAWDEV_PMD_INFO("bitstream file size: %zu\n", buffer_size);
> --
> 2.19.1.3.ge56e4f7
>
Acked-by: Rosen Xu <rosen.xu@intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH v3] drivers: ifpga_rawdev: fix fd leak in rte_fpga_do_pr
2019-04-16 7:02 ` Xu, Rosen
@ 2019-04-16 7:02 ` Xu, Rosen
0 siblings, 0 replies; 6+ messages in thread
From: Xu, Rosen @ 2019-04-16 7:02 UTC (permalink / raw)
To: Li Qiang, Zhang, Tianfei; +Cc: dev, stable, liq3ea
> -----Original Message-----
> From: Li Qiang [mailto:liq3ea@163.com]
> Sent: Tuesday, April 16, 2019 13:05
> To: Xu, Rosen <rosen.xu@intel.com>; Zhang, Tianfei
> <tianfei.zhang@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org; liq3ea@gmail.com; Li Qiang
> <liq3ea@163.com>
> Subject: [PATCH v3] 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.
>
> Coverity issue: 279441
> Fixes: ef1e8ede3da59e("raw/ifpga: add Intel FPGA bus rawdev driver")
> Cc: stable@dpdk.org
>
> Signed-off-by: Li Qiang <liq3ea@163.com>
> ---
> Change since v2: add proper tags in commit message
>
> drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> index da772d026..eff001b59 100644
> --- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> +++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> @@ -244,7 +244,8 @@ 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;
> + ret = -EINVAL;
> + goto close_fd;
> }
> buffer_size = file_stat.st_size;
> IFPGA_RAWDEV_PMD_INFO("bitstream file size: %zu\n", buffer_size);
> --
> 2.19.1.3.ge56e4f7
>
Acked-by: Rosen Xu <rosen.xu@intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-04-16 16:14 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-16 7:52 [dpdk-dev] [PATCH v3] drivers: ifpga_rawdev: fix fd leak in rte_fpga_do_pr Li Qiang
2019-04-16 7:52 ` Li Qiang
-- strict thread matches above, loose matches on Subject: below --
2019-04-16 5:05 Li Qiang
2019-04-16 5:05 ` Li Qiang
2019-04-16 7:02 ` Xu, Rosen
2019-04-16 7:02 ` Xu, Rosen
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).