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 2BA0DA00E6 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 1D8281B5C4; Wed, 17 Apr 2019 10:46:08 +0200 (CEST) Received: from m12-12.163.com (m12-12.163.com [220.181.12.12]) by dpdk.org (Postfix) with ESMTP id 107D51B45C; Tue, 16 Apr 2019 07:05:17 +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=OfNNsYlSGxJsmSJ6S2YJl+V8OD/j8/nL9x tfHGa16j3ZjVmrR4MRthE5sdnHhh3YDpHgR+HNDzFuzmLKt0KeqFjqZUW5lEyAsl vmZ8/0Jzv/VE2alPYKg4gf4ESBhXaDbnNN/S1lPxLYYjxPIN/6QF5f/tniU+QBX3 MqZt2KZ+A= Received: from test-VirtualBox.hz.ali.com (unknown [42.120.75.59]) by smtp8 (Coremail) with SMTP id DMCowAA3ED+KYrVcsbYfAg--.14765S2; Tue, 16 Apr 2019 13:05:15 +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 13:05:14 +0800 Message-Id: <20190416050514.2784-1-liq3ea@163.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: DMCowAA3ED+KYrVcsbYfAg--.14765S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrZFyDuF43XFyDJr48uFW3Jrb_yoWDuFX_ZF yqyr1xXryYywnrXr1UZw1vvr4DKa15WFn3Zr9FgF1Fkr15XFnIq34kWrZrJ3yjgwsFk3Wk tryqvry8Zr1UujkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUjJKs7UUUUU== X-Originating-IP: [42.120.75.59] X-CM-SenderInfo: 5oltjvrd6rljoofrz/1tbiFAuYbVaD0OWekwAAsH 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