From patchwork Fri Sep 14 07:31:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 44709 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 898E25F0D; Fri, 14 Sep 2018 09:31:55 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 00DD4568A; Fri, 14 Sep 2018 09:31:51 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us3.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 97E7F60005D; Fri, 14 Sep 2018 07:31:50 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 14 Sep 2018 00:31:48 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Fri, 14 Sep 2018 00:31:47 -0700 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id w8E7VkPH023606; Fri, 14 Sep 2018 08:31:46 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 419761626D1; Fri, 14 Sep 2018 08:31:46 +0100 (BST) From: Andrew Rybchenko To: CC: Igor Romanov , Date: Fri, 14 Sep 2018 08:31:35 +0100 Message-ID: <1536910296-17455-1-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24094.003 X-TM-AS-Result: No-2.902100-4.000000-10 X-TMASE-MatchedRID: ZzsyKKMlPmVjUi/S6G62dkhEDfw/93BugRykyfrH1xkJ/KT4ih4XXL6Y VRYkPkYCnbrivw+lJ4g/Z/74EQY5HZjgdm4pKakwDRBjlWdDIA1flOpBqBHTtyz+5QCTrE/sgK6 qCGa1Z9eBgcS0BXY6OKXIf4uAmyyBGAdnzrnkM48URSScn+QSXt0H8LFZNFG7CKFCmhdu5cWkFN ATU+eyFvItNgYNOTm6SDIDSvyRS6Bt24oCIUVvxjjzroEYRGRxwlF/rup9m/IDI1VSNWMLrYVZw vmjNV6PkRwvP7qEtoIPXLxHfxLeXVRHOSKs7RDUXmH0pBaurgG+4xOvsJAknp6oP1a0mRIj X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.902100-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24094.003 X-MDID: 1536910311-2bdFEuLEah6o Subject: [dpdk-dev] [PATCH 1/2] net/sfc: fix an Rx queue double release possibility 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: Igor Romanov There are two function that call sfc_rx_qfini(): sfc_rx_fini_queues() and sfc_rx_queue_release(). But only sfc_rx_queue_release() sets rx_queues pointer of the device data to NULL. It may lead to the scenario in which a queue is destroyed by sfc_rx_fini_queues() and after the queue is attempted to be destroyed again by sfc_rx_queue_release(). Move NULL assignment to sfc_rx_qfini(). Fixes: ce35b05c635e ("net/sfc: implement Rx queue setup release operations") Cc: stable@dpdk.org Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc_ethdev.c | 2 -- drivers/net/sfc/sfc_rx.c | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 435bde67f..23778c9f3 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -444,8 +444,6 @@ sfc_rx_queue_release(void *queue) sfc_log_init(sa, "RxQ=%u", sw_index); - sa->eth_dev->data->rx_queues[sw_index] = NULL; - sfc_rx_qfini(sa, sw_index); sfc_adapter_unlock(sa); diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index c6321d174..5bd6bb9be 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -1104,6 +1104,7 @@ sfc_rx_qfini(struct sfc_adapter *sa, unsigned int sw_index) struct sfc_rxq *rxq; SFC_ASSERT(sw_index < sa->rxq_count); + sa->eth_dev->data->rx_queues[sw_index] = NULL; rxq_info = &sa->rxq_info[sw_index]; From patchwork Fri Sep 14 07:31:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 44708 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8F47A5B1E; Fri, 14 Sep 2018 09:31:53 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 04F9658C4; Fri, 14 Sep 2018 09:31:52 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us3.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id C242360005C; Fri, 14 Sep 2018 07:31:50 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 14 Sep 2018 00:31:48 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Fri, 14 Sep 2018 00:31:47 -0700 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id w8E7Vk0a023613; Fri, 14 Sep 2018 08:31:46 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 482FD1626D2; Fri, 14 Sep 2018 08:31:46 +0100 (BST) From: Andrew Rybchenko To: CC: Igor Romanov , Date: Fri, 14 Sep 2018 08:31:36 +0100 Message-ID: <1536910296-17455-2-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1536910296-17455-1-git-send-email-arybchenko@solarflare.com> References: <1536910296-17455-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24094.003 X-TM-AS-Result: No-7.902300-4.000000-10 X-TMASE-MatchedRID: hHJgZaphnIOvhOOX3csmV1VN8laWo90MQPCWRE0Lo8LDTXM3VzSaIpG/ qoYvgCpnV+lCDzhvoi0aWJDnc1+/C8t+2Xe+MgKz05yZiz1u26RKPIx+MJF9o+fL+zKjW08PGXM FdYWdoJm5gxGrYcLmFbBkcxB01tpxHxPMjOKY7A8LbigRnpKlKWxlRJiH4397bRms06izKGdLmT HKXOyW80EV8+i/d6WIkmv3BB42yelo3kjLJABlcw== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--7.902300-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24094.003 X-MDID: 1536910311-3u-Ds6F8Sqgw Subject: [dpdk-dev] [PATCH 2/2] net/sfc: fix a Tx queue double release possibility 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: Igor Romanov There are two function that call sfc_tx_qfini(): sfc_tx_fini_queues() and sfc_tx_queue_release(). But only sfc_tx_queue_release() sets tx_queues pointer of the device data to NULL. It may lead to the scenario in which a queue is destroyed by sfc_tx_fini_queues() and after the queue is attempted to be destroyed again by sfc_tx_queue_release(). Move NULL assignment to sfc_tx_qfini(). Fixes: b1b7ad933b39 ("net/sfc: set up and release Tx queues") Cc: stable@dpdk.org Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc_ethdev.c | 3 --- drivers/net/sfc/sfc_tx.c | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 23778c9f3..93bfecc4e 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -498,9 +498,6 @@ sfc_tx_queue_release(void *queue) sfc_adapter_lock(sa); - SFC_ASSERT(sw_index < sa->eth_dev->data->nb_tx_queues); - sa->eth_dev->data->tx_queues[sw_index] = NULL; - sfc_tx_qfini(sa, sw_index); sfc_adapter_unlock(sa); diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c index 8af08b37c..12665d813 100644 --- a/drivers/net/sfc/sfc_tx.c +++ b/drivers/net/sfc/sfc_tx.c @@ -233,6 +233,8 @@ sfc_tx_qfini(struct sfc_adapter *sa, unsigned int sw_index) sfc_log_init(sa, "TxQ = %u", sw_index); SFC_ASSERT(sw_index < sa->txq_count); + sa->eth_dev->data->tx_queues[sw_index] = NULL; + txq_info = &sa->txq_info[sw_index]; txq = txq_info->txq;