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 8E9E4A04DD for ; Wed, 18 Nov 2020 17:38:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CAFF9C926; Wed, 18 Nov 2020 17:37:50 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by dpdk.org (Postfix) with ESMTP id B2CF1C926 for ; Wed, 18 Nov 2020 17:37:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605717467; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eZspL+ojBx9ktIJp+j987Y3636YQt8ormyYnRSCDshM=; b=TDR1sR52XL1oN0LmmwEqm+AwmV5lI2fZPCeDWzoyi7r+mT+rrQOxjbvo5d0hZ2snj7nqJB 9ZPeWguBEGklmSA0AUvFP3EHdM8SCBAAr1h9+GA10MWuqbbVh9xyELI6w7SlN64zVHLfmB AAMH4sr+ilhTH9wYdi/pzWljMQcl+ao= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-417-zpNtkRpGPDSWKXfZgDM_Hg-1; Wed, 18 Nov 2020 11:37:42 -0500 X-MC-Unique: zpNtkRpGPDSWKXfZgDM_Hg-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4ADB580F059; Wed, 18 Nov 2020 16:37:41 +0000 (UTC) Received: from rh.redhat.com (ovpn-113-249.ams2.redhat.com [10.36.113.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id 397925C1A3; Wed, 18 Nov 2020 16:37:39 +0000 (UTC) From: Kevin Traynor To: Conor Walsh Cc: Haiyue Wang , dpdk stable Date: Wed, 18 Nov 2020 16:35:37 +0000 Message-Id: <20201118163558.1101823-51-ktraynor@redhat.com> In-Reply-To: <20201118163558.1101823-1-ktraynor@redhat.com> References: <20201118163558.1101823-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-stable] patch 'net/ixgbe: check switch domain allocation result' has been queued to LTS release 18.11.11 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.11 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/24/20. 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/4508fba7011c47720984418d0c1e0b1355526d79 Thanks. Kevin. --- >From 4508fba7011c47720984418d0c1e0b1355526d79 Mon Sep 17 00:00:00 2001 From: Conor Walsh Date: Tue, 20 Oct 2020 10:02:47 +0000 Subject: [PATCH] net/ixgbe: check switch domain allocation result [ upstream commit c2c523189634c54cb99ce452a14c46d02cc4d2de ] The return value of rte_eth_switch_domain_alloc() was not being checked within ixgbe_pf_host_init() which caused a coverity issue. If the call fails a warning is logged using PMD_INIT_LOG() and *vfinfo is free'd. ixgbe_pf_host_init() now has a return value which is checked in eth_ixgbe_dev_init() Coverity issue: 362795 Fixes: cf80ba6e2038 ("net/ixgbe: add support for representor ports") Signed-off-by: Conor Walsh Acked-by: Haiyue Wang --- drivers/net/ixgbe/ixgbe_ethdev.c | 11 +++++++++-- drivers/net/ixgbe/ixgbe_ethdev.h | 2 +- drivers/net/ixgbe/ixgbe_pf.c | 16 +++++++++++++--- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index ac6f5f7def..f798d21e45 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1076,5 +1076,5 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) uint32_t ctrl_ext; uint16_t csum; - int diag, i; + int diag, i, ret; PMD_INIT_FUNC_TRACE(); @@ -1250,5 +1250,12 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) /* initialize PF if max_vfs not zero */ - ixgbe_pf_host_init(eth_dev); + ret = ixgbe_pf_host_init(eth_dev); + if (ret) { + rte_free(eth_dev->data->mac_addrs); + eth_dev->data->mac_addrs = NULL; + rte_free(eth_dev->data->hash_mac_addrs); + eth_dev->data->hash_mac_addrs = NULL; + return ret; + } ctrl_ext = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT); diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index 2177d37060..db041a8787 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -706,5 +706,5 @@ void ixgbe_vlan_hw_filter_disable(struct rte_eth_dev *dev); void ixgbe_vlan_hw_strip_config(struct rte_eth_dev *dev); -void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev); +int ixgbe_pf_host_init(struct rte_eth_dev *eth_dev); void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev); diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index 22d826cbf1..af564864d3 100644 --- a/drivers/net/ixgbe/ixgbe_pf.c +++ b/drivers/net/ixgbe/ixgbe_pf.c @@ -67,5 +67,5 @@ ixgbe_mb_intr_setup(struct rte_eth_dev *dev) } -void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev) +int ixgbe_pf_host_init(struct rte_eth_dev *eth_dev) { struct ixgbe_vf_info **vfinfo = @@ -79,4 +79,5 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev) uint16_t vf_num; uint8_t nb_queue; + int ret = 0; PMD_INIT_FUNC_TRACE(); @@ -85,5 +86,5 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev) vf_num = dev_num_vf(eth_dev); if (vf_num == 0) - return; + return ret; *vfinfo = rte_zmalloc("vf_info", sizeof(struct ixgbe_vf_info) * vf_num, 0); @@ -91,5 +92,12 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev) rte_panic("Cannot allocate memory for private VF data\n"); - rte_eth_switch_domain_alloc(&(*vfinfo)->switch_domain_id); + ret = rte_eth_switch_domain_alloc(&(*vfinfo)->switch_domain_id); + if (ret) { + PMD_INIT_LOG(ERR, + "failed to allocate switch domain for device %d", ret); + rte_free(*vfinfo); + *vfinfo = NULL; + return ret; + } memset(mirror_info, 0, sizeof(struct ixgbe_mirror_info)); @@ -119,4 +127,6 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev) /* set mb interrupt mask */ ixgbe_mb_intr_setup(eth_dev); + + return ret; } -- 2.26.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-11-18 16:33:38.899262162 +0000 +++ 0051-net-ixgbe-check-switch-domain-allocation-result.patch 2020-11-18 16:33:37.974215091 +0000 @@ -1 +1 @@ -From c2c523189634c54cb99ce452a14c46d02cc4d2de Mon Sep 17 00:00:00 2001 +From 4508fba7011c47720984418d0c1e0b1355526d79 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit c2c523189634c54cb99ce452a14c46d02cc4d2de ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org @@ -25 +26 @@ -index 00101c2eec..913c45366a 100644 +index ac6f5f7def..f798d21e45 100644 @@ -28 +29 @@ -@@ -1078,5 +1078,5 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) +@@ -1076,5 +1076,5 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) @@ -35 +36 @@ -@@ -1257,5 +1257,12 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) +@@ -1250,5 +1250,12 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) @@ -50 +51 @@ -index 33905f7136..0132fb8db7 100644 +index 2177d37060..db041a8787 100644 @@ -53 +54 @@ -@@ -718,5 +718,5 @@ void ixgbe_vlan_hw_filter_disable(struct rte_eth_dev *dev); +@@ -706,5 +706,5 @@ void ixgbe_vlan_hw_filter_disable(struct rte_eth_dev *dev); @@ -61 +62 @@ -index ed5f96b1a4..4e25b1e72e 100644 +index 22d826cbf1..af564864d3 100644