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 2863CA0096 for ; Tue, 9 Apr 2019 21:24:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 64D305587; Tue, 9 Apr 2019 21:24:42 +0200 (CEST) Received: from m12-18.163.com (m12-18.163.com [220.181.12.18]) by dpdk.org (Postfix) with ESMTP id A93294CC3 for ; Tue, 9 Apr 2019 16:32:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=0sQVxf3E7ogTAYj+Nf FAItkp42qLopUaxv/CkVNZ18w=; b=eOt2fWnLh2jzqexxeDaEXm77Tzkx9JE2bJ bEAcOnJ3I0QaXNWiQgu86M57OyZVVrtaCRQJ3RPBYVkVAead8dtYZJiZxTqcOybE ilbQUq5iSZq1oC6/PZuxnZ6lMkmRX1Qrp/Bbrjaf5vzWwB0ELkykT94Qsgs9GzgB 8q01c/QTg= Received: from localhost.localdomain (unknown [183.157.98.195]) by smtp14 (Coremail) with SMTP id EsCowABXrdf3rKxcvD9RPg--.40810S2; Tue, 09 Apr 2019 22:32:23 +0800 (CST) From: Li Qiang To: rosen.xu@intel.com, tianfei.zhang@intel.com Cc: dev@dpdk.org, liq3ea@gmail.com, Li Qiang Date: Tue, 9 Apr 2019 07:32:21 -0700 Message-Id: <20190409143221.16396-1-liq3ea@163.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: EsCowABXrdf3rKxcvD9RPg--.40810S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrZFyDuF4xKr45ZFyUur1UGFg_yoWfWFg_ZF yvyrWxXryFywnxXrn8Za4vvr4UKa15WFnavryqg3WrAr15ZF1aq3ykWrsrG3yjqw47CF1k tryjqryfZr15WjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUbT5l7UUUUU== X-Originating-IP: [183.157.98.195] X-CM-SenderInfo: 5oltjvrd6rljoofrz/xtbBLxiRbVUMIr3vYwAAsB X-Mailman-Approved-At: Tue, 09 Apr 2019 21:24:41 +0200 Subject: [dpdk-dev] [PATCH] drivers: ifpga_rawdev: fix fd leak in rte_fpga_do_pr X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190409143221.dDJsYHcnpWirujIVj6zEDKetYa0gfRs46S_UX7jCXPM@z> 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 --- 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; + goto close_fd; } buffer_size = file_stat.st_size; IFPGA_RAWDEV_PMD_INFO("bitstream file size: %zu\n", buffer_size); -- 2.17.1