From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0086.outbound.protection.outlook.com [104.47.2.86]) by dpdk.org (Postfix) with ESMTP id C7233160; Wed, 28 Mar 2018 14:10:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=F29rDGNRgJiz2maDuQC8SU7cTEOZdvVVl9zQ5jXDE6A=; b=fUAwaL9F1GUv84szDeXUpOqmiB7Xwr2nCrBal9Wz4nRe6h/iUYN3X2Ny4lmm8OKKO3UN7WDyh8BYfSJiTDuFRgqPxfqBSG6rRig9tsBAkIbwEcZeXd+9AUGTXWaHiKahRFZLSdqa39NZWxOteQVYnXTtomKzEiDKY517sjnCbFw= Received: from mellanox.com (37.142.13.130) by VI1PR0501MB2670.eurprd05.prod.outlook.com (2603:10a6:800:9d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.609.10; Wed, 28 Mar 2018 12:10:48 +0000 From: Matan Azrad To: Thomas Monjalon Cc: dev@dpdk.org, Ferruh Yigit , stable@dpdk.org Date: Wed, 28 Mar 2018 12:10:30 +0000 Message-Id: <1522239030-24489-1-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.9.5 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0501CA0008.eurprd05.prod.outlook.com (2603:10a6:800:92::18) To VI1PR0501MB2670.eurprd05.prod.outlook.com (2603:10a6:800:9d::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 0a9da381-5895-4672-9650-08d594a4f192 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0501MB2670; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2670; 3:gQ5vPPZbSfncOOjv0RfBO0zandUog6Vt70Np9n5H0dY2KcD3SplONRBAdpHDwn3f23gpOt/BMDiYk9cVKYUviMEU75vudVotxnFRRvqCcSRcvIUJvqWNYpyQTSPWGzL/KTx6pxSWEqjz0QXrJs6zCk/apffwrHtPl+mSp9E/a4WAHhv/tzCkDqPaXqSQwcO6MvS3OBitWhYww1jFD2YEhN7bV+F911j7mvCOdMXCC83WvHyfK7IWeJOLa2mNB+CQ; 25:5aH97krH21XGzLo+DcXLgfhtX1vmfUkZj1qrJF1pcr2X59xQD+tnd8LVsxsYiuUKRo9PSjPbP9wNib9/eTejzqgnnneLEy3Kn8K+WkZjjqp4q0NtLgMgPc9yhz3s50UbM15q56W0GAp+nGLbP4jqgP0g1hZDY078QtxTYWitkwTk24DkcH0soWky2J33D/KJC+3CKf4SLhwvl/NYn/WkGSICyD+0MAxTjuYhPdWGQcTc5zCIM6j5AMhCv6mWWhkEShwy+MXPcE4HXu5Cnz9UGVE8IhoEYG9osoGE+21ZTEn+oxV3vEjOvAFs0JlxWKEv2y2Y950dxd+9s5dAveabgg==; 31:JejNq6hiPsz/B0LbTL3jJJ99GpY25Oj4W0wMgjaBBAkACrD9jQaKcl8BDeQzI93hHQJlEGfqeOFG57dX5KHFAuVoHl0HpagpqWVPd5cQZ9s+kRyW7pIjFPHbyJqvvlwLR3/QA3xFYaLg67OfS8SUGIrcZucKY+SF0lPIGWcf3RX0Z4XGTLK/hYApHttBVLW4EVfTfgxPEYx7doOephdaxyp4F3/UOcRD64EernPKSLg= X-MS-TrafficTypeDiagnostic: VI1PR0501MB2670: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2670; 20:qtI9BmcO77AVoZOCKGtYscAd/2LMjo5MPwleRFyaQhzxPLJ7IaiLRJ+1a6zPMvARBClweU3ZsLMKg1qakcQcSlVbCBxvJIW1Htupr27/I/DvumTZJQ+pWxZ6i+qE/ow7GsQ3lfghI43/ohnhMGyM5Anhg4GOfiAcfXXo2kNBC6FKJTxJniIJYYLEhnGJze3+GLZzvxjDCHzsaT2NlF7XA5/9ncKhgMqrb1xf2yPgzY/yd78iiOzduUrCKolo76nG4fVGzKahFlPLMS2bkyijdt+gSxW5g/caN9Y8uFjtuDKgR9GPylLR2M+HTPtHqjIM3ycHvEy+IER0tdIMCbUsq2H9QKCDrmuXAslUrdEYUmIJSrA1pQlS9wTiS5FgMmsJVinWxzqXvTTErFoe85cXPlhMXml4acdg72zV3V+6EaSCHKhtnKXVMaUZ3ce+bPhHEilGFo++HN1sCAZzsqqURKC8w0fJjtgUapvrsCnEv4o6T4Z3cyB3ai4wMZ//Q5AG; 4:/QYjMXCylMAtIFdeR4cNL3shvIBXBPAy+qqpnph6M8rttRBa9P6tMCUb3bwLxrByxnrI5No+Q/4qVRUsGUygwXUzEVC2plGAY5ONPCgExRF3u3RvEJTiDuloPOONhWkZ0s1/v2G2ZC9aB/rWW7OIo/sWtNRcwyjihUqZWRnPRVXxvHQnrtUQK8ceAnhCBq/KjXOmkJ5Gh01wIsTQ+DCs29qKN/3apqrZHqmAhHC4FR/EuX0wRzyhJc/cIrAlzcd40bAYGALv53yL6Xq5uoy/HurSNSzb66JzbSeIGXfuBaaFtXCZU4aSoYlqfyFsAa+x X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231221)(944501327)(52105095)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:VI1PR0501MB2670; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2670; X-Forefront-PRVS: 06259BA5A2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(396003)(346002)(376002)(39860400002)(366004)(199004)(189003)(956004)(478600001)(305945005)(55016002)(33026002)(86362001)(25786009)(7736002)(81166006)(81156014)(8676002)(7696005)(50466002)(48376002)(66066001)(6116002)(3846002)(386003)(486005)(476003)(486005)(52116002)(1857600001)(47776003)(2616005)(97736004)(51416003)(26005)(6346003)(316002)(5660300001)(186003)(16526019)(6666003)(6916009)(16586007)(68736007)(21086003)(36756003)(53936002)(69596002)(8936002)(105586002)(4326008)(106356001)(50226002)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2670; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0501MB2670; 23:gBPSoUoTuFYw7kG4QwQO1CNzh+q5vXRUd7vRx54?= =?us-ascii?Q?CZMhyMlg8IOIVsbhguNU5J83C/KqKbI7NyXjpmydxlenVtCfE+7YQRL3N3wb?= =?us-ascii?Q?BMnvWzTvTkejuCdYuu07yuYZy3qfsgIOOMwNq6MGd06/yVLqYawEPwM/CdwY?= =?us-ascii?Q?kvW5KsVGl8Zx6hNwXYQG41XqqPe0UTEbxLWlSu6bSjqm6SDpoIEitHOPLDmP?= =?us-ascii?Q?cFgeq/xYTX1xZfoZ6QXtzBvRWNcKUlnheCfol4+Vl4tBbROWByJwOt9BlXAN?= =?us-ascii?Q?6Krskt//5s8jtCCXzUpdjiSphs33wu2FUmiQl066B8NnMAQ9r/AHDK7WC/yF?= =?us-ascii?Q?4P4ck9diceIVlStVbNLRf6XrGuKYdvvxynEq+n3LoQ+MQUzZILkCSk7jXX1J?= =?us-ascii?Q?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2bVso+dL7IYi9Wm3rlBNBXzk3zRXdQwI0HowQivi3x2NQLbjxW2cTpgXEoh9NXkmL/GXi+8vXzg1naysm5s96rMybb0gKdaDRwqiSeKeh7WhxcAA115GFMDxgddGiCJDz+CoNXZbBdKxrVRVNXBN9Z4vgvkx6Y+I5NAb+4R0zK06uD1TLuS X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2670; 6:RukJ0LcoFoZSQJVv/DIGI6b3boS03UP8OW+nh9iIAGbjk4mUGbglHqIsQbehXKu78/UXQO1Ug0UHXFLa5yNuCcyxAOOdAUKvUIfQD870aWDgXZX5fcTrI/sPPNLLeVBm0ZJdrv1kxXKXhPbIpisvCAmDS/Fwe8kiSsn5/lStn2htZfm7onneKjt+R6JuGVDkMa6k+XvH5BKMqdqEYYeWIZTUuHeDCUB+iPE1zgcgcSQe1pn8ovMArwMjPe66As4k4kxW8GHHkWsKci6mtdj74AYhwGVwOeyQ20M2txCBd8VDGHIvVTweSBQYW3i6M0xo1jsljt0rTGS8ggAgiN2qacbFNm7i0drwBdwFV/s/8SWVqg6SslW3HehOBIFcE1w6JCBf2JY9G5rlFKWahzUpNT6NgdTlGJdOKga3rB5/bbNhUNx8zKaJ5PJgnQuS5Gm0TaFp3gLLhkdWR+OvAhOwLQ==; 5:H1i4Tx/xVIslVcE2lXqB0l1zcLNYVFoU+bWqu6xlWM9P02aUr4YnAnonBeSst8wKfUhYAE8LAJEyB+0islsGbo4nxvXPo3m89V8NTv3SBxfCIf6xikmecHQjpQPCqjg2l7SAr8aXHYCaajIAxD5CZhHSFjE3fZvBARFRAPXbXGg=; 24:2siXjkK9kpGstYsuMCBZkjPE/F/LawDcg8c1OQJEjaD4/SepE05w7fTKrFsyDPisv/dduGdyh/YnlIF7y7E33o37QSKhcHQ2mSRlgxl2YaY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2670; 7:WhqSdoee0BqV7URYhtibsujG0/MU1L2KhTZfSFr8IvrHOBDWF0lwH52tQNC56JCfKbM2zppMPh7yMt/vissjNc+MlTuoyr0C8kBDv11uQwopgtEm2tcsNAPKlZhJy61YwIX3wK6pP5rCHLGjHQ7rs723f8soFfghl3lG9ggIkJxYEOqtymtFayCcuXFRGGZBBwUtdmzgaKg7ioDe6GNLjyQkd73h1NYgZHs0N2Rl5e5+IdWfYltjYnAtwOGz6uSX X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2018 12:10:48.4693 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0a9da381-5895-4672-9650-08d594a4f192 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2670 Subject: [dpdk-stable] [PATCH] ethdev: fix port accessing after release 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: Wed, 28 Mar 2018 12:10:52 -0000 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") Cc: stable@dpdk.org Suggested-by: Ferruh Yigit Signed-off-by: Matan Azrad --- 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 897ce5b..6565ae7 100644 --- a/lib/librte_ether/rte_ethdev_pci.h +++ b/lib/librte_ether/rte_ethdev_pci.h @@ -123,9 +123,6 @@ 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 @@ 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); -- 1.9.5