From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ktraynor@redhat.com>
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by dpdk.org (Postfix) with ESMTP id 90C991B4AA
 for <stable@dpdk.org>; Thu, 29 Nov 2018 14:22:26 +0100 (CET)
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com
 [10.5.11.22])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mx1.redhat.com (Postfix) with ESMTPS id F400B307D911;
 Thu, 29 Nov 2018 13:22:25 +0000 (UTC)
Received: from ktraynor.remote.csb (ovpn-117-230.ams2.redhat.com
 [10.36.117.230])
 by smtp.corp.redhat.com (Postfix) with ESMTP id 739DD105705E;
 Thu, 29 Nov 2018 13:22:20 +0000 (UTC)
From: Kevin Traynor <ktraynor@redhat.com>
To: Timothy Redaelli <tredaelli@redhat.com>
Cc: Rasesh Mody <rasesh.mody@cavium.com>,
	dpdk stable <stable@dpdk.org>
Date: Thu, 29 Nov 2018 13:20:21 +0000
Message-Id: <20181129132128.7609-21-ktraynor@redhat.com>
In-Reply-To: <20181129132128.7609-1-ktraynor@redhat.com>
References: <20181129132128.7609-1-ktraynor@redhat.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
 (mx1.redhat.com [10.5.110.48]); Thu, 29 Nov 2018 13:22:26 +0000 (UTC)
Subject: [dpdk-stable] patch 'net/qede: fix crash when configure fails' 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 <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 29 Nov 2018 13:22:27 -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 12/08/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 4ccc689fb102088eb3e706ad7b51ffa5b16245ef Mon Sep 17 00:00:00 2001
From: Timothy Redaelli <tredaelli@redhat.com>
Date: Fri, 9 Nov 2018 16:45:40 +0100
Subject: [PATCH] net/qede: fix crash when configure fails

[ upstream commit 69d3e963e446be9c8d98638223589e8cdf44dd9e ]

Currently, if configuration fails (for example if a 100G card is used
with an odd number of RX/TX queues) QEDE crashes due to a null pointer
dereference.

This commit fixes it by checking that the pointer is not NULL before
using it.

Fixes: 7105b24f4bb8 ("net/qede: fix memory alloc for multiple port reconfig")

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Acked-by: Rasesh Mody <rasesh.mody@cavium.com>
---
 drivers/net/qede/qede_rxtx.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index 675c0a033..963a8b421 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -236,10 +236,11 @@ void qede_rx_queue_release(void *rx_queue)
 {
 	struct qede_rx_queue *rxq = rx_queue;
-	struct qede_dev *qdev = rxq->qdev;
-	struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
-
-	PMD_INIT_FUNC_TRACE(edev);
+	struct qede_dev *qdev;
+	struct ecore_dev *edev;
 
 	if (rxq) {
+		qdev = rxq->qdev;
+		edev = QEDE_INIT_EDEV(qdev);
+		PMD_INIT_FUNC_TRACE(edev);
 		qede_rx_queue_release_mbufs(rxq);
 		qdev->ops->common->chain_free(edev, &rxq->rx_bd_ring);
@@ -400,10 +401,11 @@ void qede_tx_queue_release(void *tx_queue)
 {
 	struct qede_tx_queue *txq = tx_queue;
-	struct qede_dev *qdev = txq->qdev;
-	struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
-
-	PMD_INIT_FUNC_TRACE(edev);
+	struct qede_dev *qdev;
+	struct ecore_dev *edev;
 
 	if (txq) {
+		qdev = txq->qdev;
+		edev = QEDE_INIT_EDEV(qdev);
+		PMD_INIT_FUNC_TRACE(edev);
 		qede_tx_queue_release_mbufs(txq);
 		qdev->ops->common->chain_free(edev, &txq->tx_pbl);
-- 
2.19.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2018-11-29 13:11:35.559278678 +0000
+++ 0020-net-qede-fix-crash-when-configure-fails.patch	2018-11-29 13:11:34.000000000 +0000
@@ -1,8 +1,10 @@
-From 69d3e963e446be9c8d98638223589e8cdf44dd9e Mon Sep 17 00:00:00 2001
+From 4ccc689fb102088eb3e706ad7b51ffa5b16245ef Mon Sep 17 00:00:00 2001
 From: Timothy Redaelli <tredaelli@redhat.com>
 Date: Fri, 9 Nov 2018 16:45:40 +0100
 Subject: [PATCH] net/qede: fix crash when configure fails
 
+[ upstream commit 69d3e963e446be9c8d98638223589e8cdf44dd9e ]
+
 Currently, if configuration fails (for example if a 100G card is used
 with an odd number of RX/TX queues) QEDE crashes due to a null pointer
 dereference.
@@ -11,7 +13,6 @@
 using it.
 
 Fixes: 7105b24f4bb8 ("net/qede: fix memory alloc for multiple port reconfig")
-Cc: stable@dpdk.org
 
 Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
 Acked-by: Rasesh Mody <rasesh.mody@cavium.com>
@@ -20,7 +21,7 @@
  1 file changed, 10 insertions(+), 8 deletions(-)
 
 diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
-index 8a4772f46..296189107 100644
+index 675c0a033..963a8b421 100644
 --- a/drivers/net/qede/qede_rxtx.c
 +++ b/drivers/net/qede/qede_rxtx.c
 @@ -236,10 +236,11 @@ void qede_rx_queue_release(void *rx_queue)