From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3901C432C0 for ; Wed, 20 Nov 2019 09:47:57 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 78C3421D7A for ; Wed, 20 Nov 2019 09:47:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 78C3421D7A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 876367CBC; Wed, 20 Nov 2019 10:47:55 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 1097C2E8F for ; Wed, 20 Nov 2019 10:47:53 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from matan@mellanox.com) with ESMTPS (AES256-SHA encrypted); 20 Nov 2019 11:47:53 +0200 Received: from pegasus07.mtr.labs.mlnx (pegasus07.mtr.labs.mlnx [10.210.16.112]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id xAK9lrBZ007138; Wed, 20 Nov 2019 11:47:53 +0200 From: Matan Azrad To: dev@dpdk.org Cc: mukawa@igel.co.jp, stable@dpdk.org Date: Wed, 20 Nov 2019 09:47:51 +0000 Message-Id: <1574243271-27734-1-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1573548459-6931-1-git-send-email-matan@mellanox.com> References: <1573548459-6931-1-git-send-email-matan@mellanox.com> Subject: [dpdk-dev] [PATCH v2] bus/pci: fix driver detach clear 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" When a rte_device is unplugged, the driver should be detached from the device. The PCI detach driver operation wrongly didn't clear the driver from the device structure what remain the device in probe state from the EAL point of view. For example, when a device is removed twice using rte_dev_remove, it cause a crash in EAL. Clear the driver in driver detach successful operation. Fixes: dbe6b4b61b0e ("pci: probe or close device") Cc: mukawa@igel.co.jp Cc: stable@dpdk.org Signed-off-by: Matan Azrad --- drivers/bus/pci/pci_common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index 6b46b4f..3f55420 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -247,6 +247,7 @@ static struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *dev) /* clear driver structure */ dev->driver = NULL; + dev->device.driver = NULL; if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) /* unmap resources for devices that use igb_uio */ -- 1.8.3.1