From patchwork Tue Apr 7 04:23:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunjian Wang X-Patchwork-Id: 67890 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6AD33A0577; Tue, 7 Apr 2020 06:23:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 37E3D1BF72; Tue, 7 Apr 2020 06:23:39 +0200 (CEST) Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by dpdk.org (Postfix) with ESMTP id 5EEBA1BF54; Tue, 7 Apr 2020 06:23:37 +0200 (CEST) Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 27BE2F7AD8903DFD2C96; Tue, 7 Apr 2020 12:23:36 +0800 (CST) Received: from localhost (10.173.251.152) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.487.0; Tue, 7 Apr 2020 12:23:27 +0800 From: wangyunjian To: CC: , , , Yunjian Wang , Date: Tue, 7 Apr 2020 12:23:26 +0800 Message-ID: <1586233406-10268-1-git-send-email-wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [10.173.251.152] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v3 4/5] net/tap: fix close a valid fd 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 is freed and setted NULL in the rte_eth_dev_release_port() and zero is a valid fd. As a result, a valid fd is incorrectly closed. Fixes: 3101191c63ab ("net/tap: fix device removal when no queue exist") 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 703fcceb9..88cd615e0 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -2468,12 +2468,12 @@ rte_pmd_tap_remove(struct rte_vdev_device *dev) if (tap_devices_count == 1) rte_mp_action_unregister(TAP_MP_KEY); tap_devices_count--; - rte_eth_dev_release_port(eth_dev); if (internals->ka_fd != -1) { close(internals->ka_fd); internals->ka_fd = -1; } + rte_eth_dev_release_port(eth_dev); return 0; }