patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 17.11 1/6] net/failsafe: fix crash on slave queue release
@ 2018-12-10 15:10 Andrew Rybchenko
  2018-12-10 15:10 ` [dpdk-stable] [PATCH 17.11 2/6] net/sfc/base: fix ID retrieval in v3 licensing Andrew Rybchenko
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Andrew Rybchenko @ 2018-12-10 15:10 UTC (permalink / raw)
  To: stable; +Cc: Igor Romanov

From: Igor Romanov <igor.romanov@oktetlabs.ru>

[ backported from 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 <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 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 9a5d873..885d63c 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -260,9 +260,13 @@
 		return;
 	rxq = queue;
 	dev = rxq->priv->dev;
-	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);
 }
@@ -328,9 +332,13 @@
 		return;
 	txq = queue;
 	dev = txq->priv->dev;
-	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);
 }
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-12-11 19:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-10 15:10 [dpdk-stable] [PATCH 17.11 1/6] net/failsafe: fix crash on slave queue release Andrew Rybchenko
2018-12-10 15:10 ` [dpdk-stable] [PATCH 17.11 2/6] net/sfc/base: fix ID retrieval in v3 licensing Andrew Rybchenko
2018-12-10 15:10 ` [dpdk-stable] [PATCH 17.11 3/6] net/failsafe: add checks for deferred queue setup Andrew Rybchenko
2018-12-10 15:10 ` [dpdk-stable] [PATCH 17.11 4/6] net/sfc: do not skip RSS configuration step on reconfigure Andrew Rybchenko
2018-12-10 15:10 ` [dpdk-stable] [PATCH 17.11 5/6] net/sfc: allow to query RSS key and HF in isolated mode Andrew Rybchenko
2018-12-10 15:10 ` [dpdk-stable] [PATCH 17.11 6/6] net/sfc: allow to query RSS key and HF when RSS is disabled Andrew Rybchenko
2018-12-11 19:08 ` [dpdk-stable] [PATCH 17.11 1/6] net/failsafe: fix crash on slave queue release Yongseok Koh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).