From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id E25F5A06BD for ; Wed, 17 Apr 2019 10:46:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 461ED1B5D7; Wed, 17 Apr 2019 10:46:08 +0200 (CEST) Received: from m12-16.163.com (m12-16.163.com [220.181.12.16]) by dpdk.org (Postfix) with ESMTP id 0C49E1B476; Tue, 16 Apr 2019 09:52:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=vT1wcGh7c0kusJ9Jug dLSwNCLku5trOz/gfHedwJmv0=; b=fJ95xo/uOj31mLFcMnD05+pOzXi5N/EPS7 397wNdBF63879DHloCATyF9Fwhvag/RamNJ+12kKo7GJwLsIUqRRdZljWObW6F2N eX6DDUL3JNQ4ogzicCmS1tCKuI0uN18AU3UTBHqwp7heYjqgbiKIfN92VHc/MAlA QtSB7e9Ao= Received: from test-VirtualBox.hz.ali.com (unknown [42.120.75.59]) by smtp12 (Coremail) with SMTP id EMCowABnb12_ibVcqsY6Ag--.9093S2; Tue, 16 Apr 2019 15:52:32 +0800 (CST) From: Li Qiang To: rosen.xu@intel.com, tianfei.zhang@intel.com Cc: dev@dpdk.org, stable@dpdk.org, liq3ea@gmail.com, Li Qiang Date: Tue, 16 Apr 2019 15:52:30 +0800 Message-Id: <20190416075230.3087-1-liq3ea@163.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: EMCowABnb12_ibVcqsY6Ag--.9093S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrZFyDuF43XFyDJr48uFW3Jrb_yoWDuFX_ZF yqyr1xXryYywnrXr1UZw1vvr4DKa15WFn3Zr9FgF1Fkr15XFnIq34kWrZrJ3yjgwsFk3Wk tryqvry8Zr1UujkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUbYiiPUUUUU== X-Originating-IP: [42.120.75.59] X-CM-SenderInfo: 5oltjvrd6rljoofrz/1tbitAKYbVSIbjDThAAAsW X-Mailman-Approved-At: Wed, 17 Apr 2019 10:46:07 +0200 Subject: [dpdk-stable] [PATCH v3] drivers: ifpga_rawdev: fix fd leak in rte_fpga_do_pr X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 --- 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