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 B3199A04F0 for ; Thu, 19 Dec 2019 15:40:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A4AF81BFF7; Thu, 19 Dec 2019 15:40:43 +0100 (CET) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by dpdk.org (Postfix) with ESMTP id E60711BFF7 for ; Thu, 19 Dec 2019 15:40:42 +0100 (CET) Received: by mail-wm1-f50.google.com with SMTP id m24so5676282wmc.3 for ; Thu, 19 Dec 2019 06:40:42 -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=WdqnXb/gwNKY50kuFQnNeoUdf9GYC5mA7X6GPBva0No=; b=UDm8qa5YF9f2fDkrNv29osRLndcZ3WP2VGGKGHlJl1WeaI/l2/n0M71EkK7Oi+p4ju jR1/EMzN4jk75Ti0S7BbOdsRRlpLYaO25u+hf2yONkmfp0ICebAOsj7eGLH4IWjyhOJm Kdw94DhRndVuwY/IeL95rpOO2aQDBENOZtgVq1MGS6b6daF8NdGZ5SKSsEJScJrOrRaX JIhz7b22jLEtERspZWMwqs8yqIdTq2RXGxEJmFg2H4fH3cN/b0ppm/5SKNiihFjLijCc fLoT/y6Za0QPMUAdUA1n27sIixC6/qdP4qUD+UFJoTX3IUqeqqC8ARkLutxP/oqfJGXw jIGg== 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=WdqnXb/gwNKY50kuFQnNeoUdf9GYC5mA7X6GPBva0No=; b=NmEPssRSxe919V1G9xzxnU4ByIVQIEwYXPR5tqyX3iAuFsiCTZtzigXh40B5GMYJQh wUENUNcEQ/Tl6HwdDdAuNRZcMc+Es46yXl9Pa9l91L/qGDtxGBiRlRf6v18Wcdffqi7n EYYZcRPYAyHjgxr9CFL02M/SLyKVsJ90si3BkQ12quXYSGkGAjWaXnnkFZw930t4uywl PrwPxrp5CDX1SsSrPitUZdLypkgs8lqtcTmTrC8GUnvsqMkKJLqT6fdfHv9emU5XBY2h NNWqcmAylqqSdtaDPqa1M8U4n0GQwYmt5z1AXx540ZJFXs5hoIWkgalsFYjjlSCV5/AB uOAg== X-Gm-Message-State: APjAAAUYa4+y+EiXTCRPujBx4lVu330ShWVoJ9k/i8/yYixElK1gH1Tv b29TFA/Y8LkQlEMhBwrUALU= X-Google-Smtp-Source: APXvYqySSCN2xNpoiB2ikqdd2YklzJMZk7OSuxu9s/Cgzk+HksgWhv0caLGHcUVoEXrK+YKvl5683A== X-Received: by 2002:a1c:66d5:: with SMTP id a204mr10074197wmc.64.1576766442574; Thu, 19 Dec 2019 06:40:42 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id l7sm6581415wrq.61.2019.12.19.06.40.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 06:40:41 -0800 (PST) From: luca.boccassi@gmail.com To: Junyu Jiang Cc: Chas Williams , dpdk stable Date: Thu, 19 Dec 2019 14:34:16 +0000 Message-Id: <20191219143447.21506-109-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191219143447.21506-1-luca.boccassi@gmail.com> References: <20191219143447.21506-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/bonding: fix port ID check' has been queued to LTS release 17.11.10 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 17.11.10 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/21/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. Thanks. Luca Boccassi --- >From 281bcf2c7ea315d0d6ecf06d555f4b6c0c860766 Mon Sep 17 00:00:00 2001 From: Junyu Jiang Date: Tue, 29 Oct 2019 02:23:41 +0000 Subject: [PATCH] net/bonding: fix port ID check [ upstream commit 588ae95e79834495f78192fc6bb3ae14c152439f ] Port validation should be prior to getting device data to avoid segment fault. This patch fixed the segment fault caused by invalid port using. Fixes: 6d72657ce379 ("net/bonding: add other aggregator modes") Fixes: 112891cd27e5 ("net/bonding: add dedicated HW queues for LACP control") Signed-off-by: Junyu Jiang Acked-by: Chas Williams --- drivers/net/bonding/rte_eth_bond_8023ad.c | 36 +++++++++++++++-------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index faaaddec69..4b98730bd7 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -1321,11 +1321,12 @@ rte_eth_bond_8023ad_agg_selection_set(uint16_t port_id, struct bond_dev_private *internals; struct mode8023ad_private *mode4; - bond_dev = &rte_eth_devices[port_id]; - internals = bond_dev->data->dev_private; - if (valid_bonded_port_id(port_id) != 0) return -EINVAL; + + bond_dev = &rte_eth_devices[port_id]; + internals = bond_dev->data->dev_private; + if (internals->mode != 4) return -EINVAL; @@ -1342,11 +1343,12 @@ int rte_eth_bond_8023ad_agg_selection_get(uint16_t port_id) struct bond_dev_private *internals; struct mode8023ad_private *mode4; - bond_dev = &rte_eth_devices[port_id]; - internals = bond_dev->data->dev_private; - if (valid_bonded_port_id(port_id) != 0) return -EINVAL; + + bond_dev = &rte_eth_devices[port_id]; + internals = bond_dev->data->dev_private; + if (internals->mode != 4) return -EINVAL; mode4 = &internals->mode4; @@ -1599,9 +1601,14 @@ int rte_eth_bond_8023ad_dedicated_queues_enable(uint16_t port) { int retval = 0; - struct rte_eth_dev *dev = &rte_eth_devices[port]; - struct bond_dev_private *internals = (struct bond_dev_private *) - dev->data->dev_private; + struct rte_eth_dev *dev; + struct bond_dev_private *internals; + + if (valid_bonded_port_id(port) != 0) + return -EINVAL; + + dev = &rte_eth_devices[port]; + internals = dev->data->dev_private; if (check_for_bonded_ethdev(dev) != 0) return -1; @@ -1623,9 +1630,14 @@ int rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port) { int retval = 0; - struct rte_eth_dev *dev = &rte_eth_devices[port]; - struct bond_dev_private *internals = (struct bond_dev_private *) - dev->data->dev_private; + struct rte_eth_dev *dev; + struct bond_dev_private *internals; + + if (valid_bonded_port_id(port) != 0) + return -EINVAL; + + dev = &rte_eth_devices[port]; + internals = dev->data->dev_private; if (check_for_bonded_ethdev(dev) != 0) return -1; -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-12-19 14:32:30.651954122 +0000 +++ 0109-net-bonding-fix-port-ID-check.patch 2019-12-19 14:32:26.257300840 +0000 @@ -1,15 +1,16 @@ -From 588ae95e79834495f78192fc6bb3ae14c152439f Mon Sep 17 00:00:00 2001 +From 281bcf2c7ea315d0d6ecf06d555f4b6c0c860766 Mon Sep 17 00:00:00 2001 From: Junyu Jiang Date: Tue, 29 Oct 2019 02:23:41 +0000 Subject: [PATCH] net/bonding: fix port ID check +[ upstream commit 588ae95e79834495f78192fc6bb3ae14c152439f ] + Port validation should be prior to getting device data to avoid segment fault. This patch fixed the segment fault caused by invalid port using. Fixes: 6d72657ce379 ("net/bonding: add other aggregator modes") Fixes: 112891cd27e5 ("net/bonding: add dedicated HW queues for LACP control") -Cc: stable@dpdk.org Signed-off-by: Junyu Jiang Acked-by: Chas Williams @@ -18,10 +19,10 @@ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c -index badcd109ae..05b3004c4c 100644 +index faaaddec69..4b98730bd7 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c -@@ -1387,11 +1387,12 @@ rte_eth_bond_8023ad_agg_selection_set(uint16_t port_id, +@@ -1321,11 +1321,12 @@ rte_eth_bond_8023ad_agg_selection_set(uint16_t port_id, struct bond_dev_private *internals; struct mode8023ad_private *mode4; @@ -37,7 +38,7 @@ if (internals->mode != 4) return -EINVAL; -@@ -1408,11 +1409,12 @@ int rte_eth_bond_8023ad_agg_selection_get(uint16_t port_id) +@@ -1342,11 +1343,12 @@ int rte_eth_bond_8023ad_agg_selection_get(uint16_t port_id) struct bond_dev_private *internals; struct mode8023ad_private *mode4; @@ -53,7 +54,7 @@ if (internals->mode != 4) return -EINVAL; mode4 = &internals->mode4; -@@ -1665,9 +1667,14 @@ int +@@ -1599,9 +1601,14 @@ int rte_eth_bond_8023ad_dedicated_queues_enable(uint16_t port) { int retval = 0; @@ -71,7 +72,7 @@ if (check_for_bonded_ethdev(dev) != 0) return -1; -@@ -1689,9 +1696,14 @@ int +@@ -1623,9 +1630,14 @@ int rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port) { int retval = 0;