From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 03F7C5323 for ; Tue, 20 Nov 2018 20:16:08 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 641F3308FBA1; Tue, 20 Nov 2018 19:16:07 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2910E60141; Tue, 20 Nov 2018 19:16:05 +0000 (UTC) From: Kevin Traynor To: Igor Romanov Cc: Andrew Rybchenko , Gaetan Rivet , dpdk stable Date: Tue, 20 Nov 2018 19:12:49 +0000 Message-Id: <20181120191252.30277-59-ktraynor@redhat.com> In-Reply-To: <20181120191252.30277-1-ktraynor@redhat.com> References: <20181120191252.30277-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 20 Nov 2018 19:16:07 +0000 (UTC) Subject: [dpdk-stable] patch 'net/failsafe: fix crash on slave queue release' has been queued to stable release 18.08.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Nov 2018 19:16:08 -0000 Hi, FYI, your patch has been queued to stable release 18.08.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/23/18. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. If the code is different (ie: not only metadata diffs), due for example to a change in context or macro names, please double check it. Thanks. Kevin Traynor --- >>From 6de567f87a8e135e52156fa6a1e2a91a819b4aff Mon Sep 17 00:00:00 2001 From: Igor Romanov Date: Fri, 31 Aug 2018 17:16:32 +0100 Subject: [PATCH] net/failsafe: fix crash on slave queue release [ upstream commit 6b35f4d88b40645425b4b8e156423982471eccf5 ] Releasing a queue that is already released by slave may cause a segmentation fault. For example, after a successfull device configuration a queue is set up. Afterwards the device is reconfigured with an invalid argument, forcing slaves to release the queues (e.g. rte_eth_dev.data.tx_queues). Finally the failsafe's queues are released. The queue release functions also try to release slaves' queues using ETH(sdev)->data->tx_queues which is NULL at the time. Add checks for NULL slaves' Tx and Rx queues before releasing them. Fixes: a46f8d584eb8 ("net/failsafe: add fail-safe PMD") Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko Acked-by: Gaetan Rivet --- drivers/net/failsafe/failsafe_ops.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 24e91c931..94b9769e7 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -310,7 +310,11 @@ fs_rx_queue_release(void *queue) if (rxq->event_fd > 0) close(rxq->event_fd); - FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) - SUBOPS(sdev, rx_queue_release) - (ETH(sdev)->data->rx_queues[rxq->qid]); + FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { + if (ETH(sdev)->data->rx_queues != NULL && + ETH(sdev)->data->rx_queues[rxq->qid] != NULL) { + SUBOPS(sdev, rx_queue_release) + (ETH(sdev)->data->rx_queues[rxq->qid]); + } + } dev->data->rx_queues[rxq->qid] = NULL; rte_free(rxq); @@ -478,7 +482,11 @@ fs_tx_queue_release(void *queue) dev = txq->priv->dev; fs_lock(dev, 0); - FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) - SUBOPS(sdev, tx_queue_release) - (ETH(sdev)->data->tx_queues[txq->qid]); + FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { + if (ETH(sdev)->data->tx_queues != NULL && + ETH(sdev)->data->tx_queues[txq->qid] != NULL) { + SUBOPS(sdev, tx_queue_release) + (ETH(sdev)->data->tx_queues[txq->qid]); + } + } dev->data->tx_queues[txq->qid] = NULL; rte_free(txq); -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-11-20 17:53:08.878420717 +0000 +++ 0059-net-failsafe-fix-crash-on-slave-queue-release.patch 2018-11-20 17:53:07.000000000 +0000 @@ -1,8 +1,10 @@ -From 6b35f4d88b40645425b4b8e156423982471eccf5 Mon Sep 17 00:00:00 2001 +From 6de567f87a8e135e52156fa6a1e2a91a819b4aff Mon Sep 17 00:00:00 2001 From: Igor Romanov Date: Fri, 31 Aug 2018 17:16:32 +0100 Subject: [PATCH] net/failsafe: fix crash on slave queue release +[ upstream commit 6b35f4d88b40645425b4b8e156423982471eccf5 ] + Releasing a queue that is already released by slave may cause a segmentation fault. For example, after a successfull device configuration a queue is set up. Afterwards the device is reconfigured @@ -14,7 +16,6 @@ Add checks for NULL slaves' Tx and Rx queues before releasing them. Fixes: a46f8d584eb8 ("net/failsafe: add fail-safe PMD") -Cc: stable@dpdk.org Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko @@ -24,10 +25,10 @@ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c -index d989a17bf..49b155045 100644 +index 24e91c931..94b9769e7 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c -@@ -308,7 +308,11 @@ fs_rx_queue_release(void *queue) +@@ -310,7 +310,11 @@ fs_rx_queue_release(void *queue) if (rxq->event_fd > 0) close(rxq->event_fd); - FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) @@ -42,7 +43,7 @@ + } dev->data->rx_queues[rxq->qid] = NULL; rte_free(rxq); -@@ -476,7 +480,11 @@ fs_tx_queue_release(void *queue) +@@ -478,7 +482,11 @@ fs_tx_queue_release(void *queue) dev = txq->priv->dev; fs_lock(dev, 0); - FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE)