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 F15D6A00BE for ; Tue, 29 Oct 2019 16:59:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BB66C1BEB7; Tue, 29 Oct 2019 16:59:15 +0100 (CET) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) by dpdk.org (Postfix) with ESMTP id CA0FE1BEB7; Tue, 29 Oct 2019 16:59:14 +0100 (CET) Received: by mail-qt1-f194.google.com with SMTP id o49so20928234qta.7; Tue, 29 Oct 2019 08:59:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=3ybReDtLKPXddl9/iNbOWeZuY37L3WSHnGpAdRBm08E=; b=D+j/jtQ5pygmrgsuQzi44E+NhIBpwF9UUxXh+FC/+ze94s3cf3L0+DOJpeI8ww1QN2 92aBcx/JQn1gjUlVyFc3pww8yF/4ptd98KvE5UGMz2fk2Jy2f6Hf0c1tTjLMp0NuM+L/ e4Ehj2HUUNhmdOWbpVymE+YEsa5EVzccMcFURujg9A92JIVavmVbUbRAILPABqMHM7O2 +QOfY/Zs06IjHI8TcBL1tp6WvoeXD7S8Q+X0MFzWa7yqgPyyhM5qFnR4ilocsmFXJW66 8Y3eAa/9cpKbAJ2sOMU3IegZuOg9vn1Nabpce8ZvtKEHllUZHNvpPms18FpxwIuqG5nP DKdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=3ybReDtLKPXddl9/iNbOWeZuY37L3WSHnGpAdRBm08E=; b=rXfDVb4O2e2WQav7/q/wxEpajEmJ7lWc+nG4xQ+EQIzpgkel000DgJhUVhi2f6KnDW 8IpsCfpHEsBc1A5w53c+rIPum5wtRC8EGsJmSWHEjwsdMaHXWmKrQ82bdrwxqbSV/eqj oUl2uQTOaIWhGe1hfYeF5y/m7Df2Vbs80XPxorwpkTNhW6yG66sl+Lo1FYBaHtsCZJqs NFfI+qhPHWzlmSzu8bWtQdQLmQ5h2H1pluj3pJG7K1RxpHUjN9Il36v5H8JTKT//65xV MCTp/VvzYN2tfjd0TuiiZ1U24HzSWGsnkVdt0poQBJUvAMOKOb85mIcixZvcrNv15Q3H 2NRg== X-Gm-Message-State: APjAAAX5iny3OcdjC4lm2siMIRZvkoD6sXeYhdTpNtnLV8L+I+Vq93hI djKGLbbnz40KVGI2e8L3X2eKb10m X-Google-Smtp-Source: APXvYqwxYyHdekGCfdNY75bXjzhsBddJICZHb0TfoJfqEexuqdaTrjNewlrKsmDYyUsxKRbEmQXphA== X-Received: by 2002:ac8:d6:: with SMTP id d22mr5128800qtg.290.1572364753758; Tue, 29 Oct 2019 08:59:13 -0700 (PDT) Received: from [192.168.1.10] (pool-96-255-60-31.washdc.fios.verizon.net. [96.255.60.31]) by smtp.gmail.com with ESMTPSA id d10sm6998123qko.29.2019.10.29.08.59.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 29 Oct 2019 08:59:12 -0700 (PDT) To: Jiang JunyuX , dev@dpdk.org Cc: Chas Williams , Yang Qiming , stable@dpdk.org References: <20191028204824.3159-1-junyux.jiang@intel.com> <20191029022341.5780-1-junyux.jiang@intel.com> From: Chas Williams <3chas3@gmail.com> Message-ID: <1f52050c-b5d4-f4b1-c24e-36cef00c2d89@gmail.com> Date: Tue, 29 Oct 2019 11:59:11 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191029022341.5780-1-junyux.jiang@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v4] net/bonding: fix invalid port using 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" On 10/28/19 10:23 PM, Jiang JunyuX wrote: > 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: Jiang JunyuX Acked-by: Chas Williams Patchwork says that there is a build error but it doesn't seem to be related to this change. > --- > drivers/net/bonding/rte_eth_bond_8023ad.c | 32 ++++++++++++++++------- > 1 file changed, 22 insertions(+), 10 deletions(-) > > diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c > index 7d8da2b31..682854e39 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, > struct bond_dev_private *internals; > struct mode8023ad_private *mode4; > > + if (valid_bonded_port_id(port_id) != 0) > + return -EINVAL; > + > bond_dev = &rte_eth_devices[port_id]; > internals = bond_dev->data->dev_private; > > - if (valid_bonded_port_id(port_id) != 0) > - return -EINVAL; > if (internals->mode != 4) > return -EINVAL; > > @@ -1408,11 +1409,12 @@ int rte_eth_bond_8023ad_agg_selection_get(uint16_t port_id) > struct bond_dev_private *internals; > struct mode8023ad_private *mode4; > > + if (valid_bonded_port_id(port_id) != 0) > + return -EINVAL; > + > bond_dev = &rte_eth_devices[port_id]; > internals = bond_dev->data->dev_private; > > - if (valid_bonded_port_id(port_id) != 0) > - return -EINVAL; > if (internals->mode != 4) > return -EINVAL; > mode4 = &internals->mode4; > @@ -1665,9 +1667,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; > @@ -1689,9 +1696,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; >