From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1F9E5A046B for ; Fri, 23 Aug 2019 11:44:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 14BCA1BF4C; Fri, 23 Aug 2019 11:44:43 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 68B731BF4C for ; Fri, 23 Aug 2019 11:44:41 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE6B918C8908; Fri, 23 Aug 2019 09:44:40 +0000 (UTC) Received: from rh.redhat.com (ovpn-116-48.ams2.redhat.com [10.36.116.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id C87D56377B; Fri, 23 Aug 2019 09:44:32 +0000 (UTC) From: Kevin Traynor To: David Marchand Cc: Ferruh Yigit , dpdk stable Date: Fri, 23 Aug 2019 10:43:08 +0100 Message-Id: <20190823094336.12078-18-ktraynor@redhat.com> In-Reply-To: <20190823094336.12078-1-ktraynor@redhat.com> References: <20190823094336.12078-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.70]); Fri, 23 Aug 2019 09:44:40 +0000 (UTC) Subject: [dpdk-stable] patch 'drivers/net: fix double free on init failure' has been queued to LTS release 18.11.3 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: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to LTS release 18.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/28/19. 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. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/f4aaa8cc9280685783187ce9242b1f529f8dd9db Thanks. Kevin Traynor --- >From f4aaa8cc9280685783187ce9242b1f529f8dd9db Mon Sep 17 00:00:00 2001 From: David Marchand Date: Mon, 17 Jun 2019 17:05:24 +0200 Subject: [PATCH] drivers/net: fix double free on init failure [ upstream commit e7f2fa88a71eb667788a124abbdc6d1ca1e0671e ] If we don't clear mac_addrs, ethdev will double free it on cleanup. Fixes: e16adf08e54d ("ethdev: free all common data when releasing port") Signed-off-by: David Marchand Reviewed-by: Ferruh Yigit --- drivers/net/ark/ark_ethdev.c | 6 +++--- drivers/net/axgbe/axgbe_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/thunderx/nicvf_ethdev.c | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index af37f75ee..18eb15e59 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -403,7 +403,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev) return ret; - error: - if (dev->data->mac_addrs) - rte_free(dev->data->mac_addrs); +error: + rte_free(dev->data->mac_addrs); + dev->data->mac_addrs = NULL; return -1; } diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index 2f34ad80c..8e534a760 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -701,4 +701,5 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev) if (ret) { rte_free(eth_dev->data->mac_addrs); + eth_dev->data->mac_addrs = NULL; return ret; } diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index d419c0cf0..bef5f25a4 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1594,4 +1594,5 @@ err_init_tunnel_filter_list: err_init_ethtype_filter_list: rte_free(dev->data->mac_addrs); + dev->data->mac_addrs = NULL; err_mac_alloc: i40e_vsi_release(pf->main_vsi); diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 879d88998..8f5664d7b 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -2206,4 +2206,5 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev) malloc_fail: rte_free(eth_dev->data->mac_addrs); + eth_dev->data->mac_addrs = NULL; alarm_fail: nicvf_periodic_alarm_stop(nicvf_interrupt, eth_dev); -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-08-22 19:38:21.632317543 +0100 +++ 0018-drivers-net-fix-double-free-on-init-failure.patch 2019-08-22 19:38:20.438026856 +0100 @@ -1 +1 @@ -From e7f2fa88a71eb667788a124abbdc6d1ca1e0671e Mon Sep 17 00:00:00 2001 +From f4aaa8cc9280685783187ce9242b1f529f8dd9db Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit e7f2fa88a71eb667788a124abbdc6d1ca1e0671e ] + @@ -9 +10,0 @@ -Cc: stable@dpdk.org @@ -17 +17,0 @@ - drivers/net/ice/ice_ethdev.c | 1 + @@ -19 +19 @@ - 5 files changed, 7 insertions(+), 3 deletions(-) + 4 files changed, 6 insertions(+), 3 deletions(-) @@ -22 +22 @@ -index 7fd784cd0..86e500ecb 100644 +index af37f75ee..18eb15e59 100644 @@ -25 +25 @@ -@@ -404,7 +404,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev) +@@ -403,7 +403,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev) @@ -37 +37 @@ -index 6b3bc3eea..cfb172064 100644 +index 2f34ad80c..8e534a760 100644 @@ -47 +47 @@ -index 33644557b..2b9fc4572 100644 +index d419c0cf0..bef5f25a4 100644 @@ -50 +50 @@ -@@ -1596,4 +1596,5 @@ err_init_tunnel_filter_list: +@@ -1594,4 +1594,5 @@ err_init_tunnel_filter_list: @@ -56,10 +55,0 @@ -diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c -index 203d0a9f9..1e48bd0bd 100644 ---- a/drivers/net/ice/ice_ethdev.c -+++ b/drivers/net/ice/ice_ethdev.c -@@ -1467,4 +1467,5 @@ err_pf_setup: - err_msix_pool_init: - rte_free(dev->data->mac_addrs); -+ dev->data->mac_addrs = NULL; - err_init_mac: - ice_sched_cleanup_all(hw); @@ -67 +57 @@ -index eb2c11da5..ec57692fb 100644 +index 879d88998..8f5664d7b 100644 @@ -70 +60 @@ -@@ -2207,4 +2207,5 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev) +@@ -2206,4 +2206,5 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev)