Skip to content

Commit

Permalink
raw/ifpga: fix file descriptor leak in error path
Browse files Browse the repository at this point in the history
[ upstream commit 194a83d ]

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: ef1e8ed ("raw/ifpga: add Intel FPGA bus rawdev driver")

Signed-off-by: Li Qiang <liq3ea@163.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
  • Loading branch information
terenceli authored and kevintraynor committed May 8, 2019
1 parent e1d18d8 commit 1f78ae5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/raw/ifpga_rawdev/ifpga_rawdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1f78ae5

Please sign in to comment.