From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Content-Type: text/plain 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: , X-List-Received-Date: Fri, 14 Sep 2018 07:31:52 -0000 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; -- 2.17.1