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 D1D31A0527 for ; Mon, 9 Nov 2020 19:43:09 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CB30569C8; Mon, 9 Nov 2020 19:43:08 +0100 (CET) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by dpdk.org (Postfix) with ESMTP id 4213869C8 for ; Mon, 9 Nov 2020 19:43:07 +0100 (CET) Received: by mail-wm1-f67.google.com with SMTP id p19so470284wmg.0 for ; Mon, 09 Nov 2020 10:43:07 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=P8WCwoMyqzfPHqXrUdXrw2VOCPmd4DUPfK+h+4CEzTA=; b=U0h0fbu69Mj7VqmyLU3JxqyQ4JycObH3RKY/tuF65y7tr/hYh5usRfk6nhXfVY5myC 02ZiUDlxdPKshzwYRqARnck04j6c6pllianGfVzPfLiKDtP6J9D5uLrhiyMen7cuWrj9 jJ/ZyiwxYAIF5xoGxVNz53c5w/fmuxE53CPt0whSBj6aXGiyeRAhPyAunG+q9iJ2v87a EKFvJicq3BojIsSnp6zKcA8lXblvtS2gGatYYfEQ++Zra+KKxhN8iP3ocJ8n42MgX3S+ r1PaMt0chDCI24cZZ03OonFAhcR+/f9YiQPoHJFppVYg/kcVcUoga6IrVpllkh8UVlmL oAow== 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:mime-version:content-transfer-encoding; bh=P8WCwoMyqzfPHqXrUdXrw2VOCPmd4DUPfK+h+4CEzTA=; b=X9L7RapGYAyA3xiaIym6+NkgvVP6wMoJ5kY1EzsKN8SgJ/qmK2VA9+Kw79Euhc4SNi p6GLJS6spBQ6Kbvy9lzC1cBYzGIT9I/JaW2fVeSpRV8+LC3//0+TptURrajV51hDqV/o lDNwemCRZ36zxb9rsHVIW9TGc53y6/9aR8pOWJIL3+z5DRi4vOiqZagzeGKyqM28mCPd uP2Bah7HTkfBM6yV+dIQ2JXPcURlw99jBkxmJkMXVTp63X+/kx5w5RO5uNocfVGTzS/a +EKSu9PeFB6MFBCFkJ48PccEVCZhkpY+G1BqYXFx8UiPTbnFq1rY52vGDk4Wt7vQOBKO X6ww== X-Gm-Message-State: AOAM530gGP8TO4vBBoDyAdY9xkaC7/LFmIJmiVA0pHMpF/n5QJINeqS9 V26Y3BJo8kUAyEfia2NwVrs= X-Google-Smtp-Source: ABdhPJygaFTZmH80NqSThuh6mtbYal2Pf0zyq+cef9TfKpg9wl+xkLnYZgJkmtBgLIu3WdjAO4N1sg== X-Received: by 2002:a1c:7202:: with SMTP id n2mr560405wmc.38.1604947385974; Mon, 09 Nov 2020 10:43:05 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id b14sm14069578wrx.35.2020.11.09.10.43.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2020 10:43:05 -0800 (PST) From: luca.boccassi@gmail.com To: Conor Walsh Cc: Haiyue Wang , dpdk stable Date: Mon, 9 Nov 2020 18:40:20 +0000 Message-Id: <20201109184111.3463090-32-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201109184111.3463090-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-207-luca.boccassi@gmail.com> <20201109184111.3463090-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/ixgbe: check switch domain allocation result' has been queued to stable release 19.11.6 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 stable release 19.11.6 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/11/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/cb799a36c2f214d601d525209348e992c45e1083 Thanks. Luca Boccassi --- >From cb799a36c2f214d601d525209348e992c45e1083 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 768183e9cb..de528d242b 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1095,7 +1095,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) IXGBE_DEV_PRIVATE_TO_BW_CONF(eth_dev->data->dev_private); uint32_t ctrl_ext; uint16_t csum; - int diag, i; + int diag, i, ret; PMD_INIT_FUNC_TRACE(); @@ -1274,7 +1274,14 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) memset(hwstrip, 0, sizeof(*hwstrip)); /* 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); /* let hardware know driver is loaded */ diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index 0334c226be..edb66f8258 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -712,7 +712,7 @@ 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 d0d85e1386..ca30be71eb 100644 --- a/drivers/net/ixgbe/ixgbe_pf.c +++ b/drivers/net/ixgbe/ixgbe_pf.c @@ -66,7 +66,7 @@ ixgbe_mb_intr_setup(struct rte_eth_dev *dev) return 0; } -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 = IXGBE_DEV_PRIVATE_TO_P_VFDATA(eth_dev->data->dev_private); @@ -78,19 +78,27 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev) IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); uint16_t vf_num; uint8_t nb_queue; + int ret = 0; PMD_INIT_FUNC_TRACE(); RTE_ETH_DEV_SRIOV(eth_dev).active = 0; 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); if (*vfinfo == NULL) 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)); memset(uta_info, 0, sizeof(struct ixgbe_uta_info)); @@ -118,6 +126,8 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev) /* set mb interrupt mask */ ixgbe_mb_intr_setup(eth_dev); + + return ret; } void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev) -- 2.27.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-11-09 18:40:12.504212405 +0000 +++ 0032-net-ixgbe-check-switch-domain-allocation-result.patch 2020-11-09 18:40:11.155311656 +0000 @@ -1 +1 @@ -From c2c523189634c54cb99ce452a14c46d02cc4d2de Mon Sep 17 00:00:00 2001 +From cb799a36c2f214d601d525209348e992c45e1083 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 768183e9cb..de528d242b 100644 @@ -28 +29 @@ -@@ -1077,7 +1077,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) +@@ -1095,7 +1095,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) @@ -37 +38 @@ -@@ -1256,7 +1256,14 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) +@@ -1274,7 +1274,14 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) @@ -54 +55 @@ -index 33905f7136..0132fb8db7 100644 +index 0334c226be..edb66f8258 100644 @@ -57 +58 @@ -@@ -717,7 +717,7 @@ void ixgbe_vlan_hw_filter_disable(struct rte_eth_dev *dev); +@@ -712,7 +712,7 @@ void ixgbe_vlan_hw_filter_disable(struct rte_eth_dev *dev); @@ -67 +68 @@ -index ed5f96b1a4..4e25b1e72e 100644 +index d0d85e1386..ca30be71eb 100644