From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <luca.boccassi@gmail.com>
Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68])
 by dpdk.org (Postfix) with ESMTP id BF34110BD
 for <stable@dpdk.org>; Mon, 30 Apr 2018 16:42:32 +0200 (CEST)
Received: by mail-wm0-f68.google.com with SMTP id t11so13636925wmt.0
 for <stable@dpdk.org>; Mon, 30 Apr 2018 07:42:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references;
 bh=U3MdED9kNCgvmDC30Iq2bYd/foevyd+A2hyyN8yG14M=;
 b=jf+ammi39Q2b9o3pw2yeveHAgj7XZ5Qgn1MTBolaAXvCuyPlFE7v3eDV8w20UXbqFj
 kaKVUv11dikotHxR9P+EH4KQPkpUhAu7Q+CHPceuiGd/ZVyl2VPnYpZK7wbdO486Q8kX
 S9gwccpwtPl7uVejpq1OQsdbfKULGMCGeuJk88XdTiQelWjdkGajS9R+fk3gKKDE12qB
 b03MoRnTGinYpYYs4rSmQT+uYf6ai+jEHoaTHVM59HO0bWmup6ef80OomWGhv0XqNwXr
 tqZaQ409NtCT4l+/AAJ03YR26/goXH1u9oo46DX4hdxfr/2W1039NyYyUTog50qbMY0W
 uWlA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references;
 bh=U3MdED9kNCgvmDC30Iq2bYd/foevyd+A2hyyN8yG14M=;
 b=WMPn9AyIjjkkJyVaxcl1G0RBGyYuQz92Q33mQGhNDjn4goGwVZuoeVAAoQYTOlC49B
 k9fx/YfYO/EVmkujPbuY3GXJuUL6w0omgHzdomT+4ugygBElIqZDgSl25NxjVa849sOu
 HMK9HoQTmpxw2PryCNRN3BqJQHcm8po9DVzhI8z3I6JsMup/6ypwyPhJ25/B0s2VH38r
 nr5EKFVSS9bRte017sFIggM4L8kGUn0AVCYRbgr1j4jIfEQbjxMenwrvIMO+oDnbKf3S
 SWYJV2uWxqdm3PLxyR47nBXodlR/MuE34t2mbKw/CMcfBFU7M2yQuP5qTzqbsPY/AqXh
 MlSg==
X-Gm-Message-State: ALQs6tBiXeCY+uZuPb5s/t0FsxBj1p7oIh7mZOKRg/ZbQ2cy2sGx3KIX
 T8hs280ynVD1Ggk4HqWEc2Q=
X-Google-Smtp-Source: AB8JxZo+CTkG99QNTglhAtOVa0nR/EFVPUVyNPbd+GSQuc3+vb6KMrjsUk60BAV2cQMmINFXdSMjdg==
X-Received: by 10.28.10.85 with SMTP id 82mr1384484wmk.59.1525099352378;
 Mon, 30 Apr 2018 07:42:32 -0700 (PDT)
Received: from localhost ([2a00:23c5:be9a:5200:ce4c:82c0:d567:ecbb])
 by smtp.gmail.com with ESMTPSA id 39-v6sm12002664wry.89.2018.04.30.07.42.31
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Mon, 30 Apr 2018 07:42:31 -0700 (PDT)
From: luca.boccassi@gmail.com
To: Matan Azrad <matan@mellanox.com>
Cc: Ferruh Yigit <ferruh.yigit@intel.com>,
 Thomas Monjalon <thomas@monjalon.net>, dpdk stable <stable@dpdk.org>
Date: Mon, 30 Apr 2018 15:40:19 +0100
Message-Id: <20180430144223.18657-4-luca.boccassi@gmail.com>
X-Mailer: git-send-email 2.14.2
In-Reply-To: <20180430144223.18657-1-luca.boccassi@gmail.com>
References: <20180430140606.4615-80-luca.boccassi@gmail.com>
 <20180430144223.18657-1-luca.boccassi@gmail.com>
Subject: [dpdk-stable] patch 'ethdev: fix port accessing after release' has
	been queued to stable release 18.02.2
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://dpdk.org/ml/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 30 Apr 2018 14:42:32 -0000

Hi,

FYI, your patch has been queued to stable release 18.02.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/02/18. So please
shout if anyone has objections.

Thanks.

Luca Boccassi

---
>>From ef52abb3783d209fc258b7e1bd915bc2735a3ef5 Mon Sep 17 00:00:00 2001
From: Matan Azrad <matan@mellanox.com>
Date: Wed, 28 Mar 2018 12:10:30 +0000
Subject: [PATCH] ethdev: fix port accessing after release

[ upstream commit f0e1180cb6a99825587ce4c108c4366023ac1f63 ]

rte_eth_dev_pci_release() function wrongly releases an ethdev port and
then releases internal fields of this port.
This behavior is problematic, because after the release, the port may
be reallocated again by another thread or just be invalid for any
usage.

Move the release operation to the end of the function.

Fixes: dcd5c8112bc3 ("ethdev: add PCI driver helpers")

Suggested-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/librte_ether/rte_ethdev_pci.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev_pci.h b/lib/librte_ether/rte_ethdev_pci.h
index 897ce5b41..6565ae7d3 100644
--- a/lib/librte_ether/rte_ethdev_pci.h
+++ b/lib/librte_ether/rte_ethdev_pci.h
@@ -123,9 +123,6 @@ rte_eth_dev_pci_allocate(struct rte_pci_device *dev, size_t private_data_size)
 static inline void
 rte_eth_dev_pci_release(struct rte_eth_dev *eth_dev)
 {
-	/* free ether device */
-	rte_eth_dev_release_port(eth_dev);
-
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
 		rte_free(eth_dev->data->dev_private);
 
@@ -139,6 +136,9 @@ rte_eth_dev_pci_release(struct rte_eth_dev *eth_dev)
 
 	eth_dev->device = NULL;
 	eth_dev->intr_handle = NULL;
+
+	/* free ether device */
+	rte_eth_dev_release_port(eth_dev);
 }
 
 typedef int (*eth_dev_pci_callback_t)(struct rte_eth_dev *eth_dev);
-- 
2.14.2