From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 98441A0577; Tue, 7 Apr 2020 06:23:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 777E81BF26; Tue, 7 Apr 2020 06:23:49 +0200 (CEST) Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by dpdk.org (Postfix) with ESMTP id 11CBB1BF1B; Tue, 7 Apr 2020 06:23:48 +0200 (CEST) Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 3E4BC423BD0F2503066F; Tue, 7 Apr 2020 12:23:47 +0800 (CST) Received: from localhost (10.173.251.152) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Tue, 7 Apr 2020 12:23:36 +0800 From: wangyunjian To: CC: , , , Yunjian Wang , Date: Tue, 7 Apr 2020 12:23:34 +0800 Message-ID: <1586233414-7644-1-git-send-email-wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.173.251.152] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v3 5/5] net/tap: fix netlink socket file descriptor check before close 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" From: Yunjian Wang The "internals->nlsk_fd" is possibly a zero value. Error comparison should check for negative fd. Fixes: de96fe68ae95 ("net/tap: add basic flow API patterns and actions") CC: stable@dpdk.org Signed-off-by: Yunjian Wang --- drivers/net/tap/rte_eth_tap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 88cd615e0..ff149342b 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -2442,7 +2442,7 @@ rte_pmd_tap_remove(struct rte_vdev_device *dev) TAP_LOG(DEBUG, "Closing %s Ethernet device on numa %u", tuntap_types[internals->type], rte_socket_id()); - if (internals->nlsk_fd) { + if (internals->nlsk_fd >= 0) { tap_flow_flush(eth_dev, NULL); tap_flow_implicit_flush(internals, NULL); tap_nl_final(internals->nlsk_fd); -- 2.19.1