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 A468FA00BE for ; Wed, 30 Oct 2019 03:25:04 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 586661BEB4; Wed, 30 Oct 2019 03:25:04 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id D42431BEB4; Wed, 30 Oct 2019 03:25:02 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Oct 2019 19:25:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,245,1569308400"; d="scan'208";a="203748383" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga006.jf.intel.com with ESMTP; 29 Oct 2019 19:25:01 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 29 Oct 2019 19:25:00 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.213]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.2]) with mapi id 14.03.0439.000; Wed, 30 Oct 2019 10:24:59 +0800 From: "Yang, Qiming" To: "Jiang, JunyuX" , "dev@dpdk.org" CC: Chas Williams , "stable@dpdk.org" Thread-Topic: [PATCH v4] net/bonding: fix invalid port using Thread-Index: AQHVjjZPbd5D3fX/UUyCzrZl12bVk6dydTxw Date: Wed, 30 Oct 2019 02:24:58 +0000 Message-ID: References: <20191028204824.3159-1-junyux.jiang@intel.com> <20191029022341.5780-1-junyux.jiang@intel.com> In-Reply-To: <20191029022341.5780-1-junyux.jiang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYmIxN2I4M2UtM2Q1MC00MzlhLTg2ODktNGJhNTgzMzk4MWRlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiNnJUcmdkemU5Nm1tY29KQVdFaWxRdHlcLzYzSDZXcjg2VElkbjMrbndvSGhNYzZXRlI3OVlGT01wNjJRdDdzY1oifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-stable] [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" > -----Original Message----- > From: Jiang, JunyuX > Sent: Tuesday, October 29, 2019 10:24 AM > To: dev@dpdk.org > Cc: Chas Williams ; Yang, Qiming ; > Jiang, JunyuX ; stable@dpdk.org > Subject: [PATCH v4] net/bonding: fix invalid port using >=20 > Port validation should be prior to getting device data to avoid segment f= ault. > This patch fixed the segment fault caused by invalid port using. >=20 > Fixes: 6d72657ce379 ("net/bonding: add other aggregator modes") > Fixes: 112891cd27e5 ("net/bonding: add dedicated HW queues for LACP > control") > Cc: stable@dpdk.org >=20 > Signed-off-by: Jiang JunyuX > --- > drivers/net/bonding/rte_eth_bond_8023ad.c | 32 ++++++++++++++++------- > 1 file changed, 22 insertions(+), 10 deletions(-) >=20 > 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; >=20 > + if (valid_bonded_port_id(port_id) !=3D 0) > + return -EINVAL; > + > bond_dev =3D &rte_eth_devices[port_id]; > internals =3D bond_dev->data->dev_private; >=20 > - if (valid_bonded_port_id(port_id) !=3D 0) > - return -EINVAL; > if (internals->mode !=3D 4) > return -EINVAL; >=20 > @@ -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; >=20 > + if (valid_bonded_port_id(port_id) !=3D 0) > + return -EINVAL; > + > bond_dev =3D &rte_eth_devices[port_id]; > internals =3D bond_dev->data->dev_private; >=20 > - if (valid_bonded_port_id(port_id) !=3D 0) > - return -EINVAL; > if (internals->mode !=3D 4) > return -EINVAL; > mode4 =3D &internals->mode4; > @@ -1665,9 +1667,14 @@ int > rte_eth_bond_8023ad_dedicated_queues_enable(uint16_t port) { > int retval =3D 0; > - struct rte_eth_dev *dev =3D &rte_eth_devices[port]; > - struct bond_dev_private *internals =3D (struct bond_dev_private *) > - dev->data->dev_private; > + struct rte_eth_dev *dev; > + struct bond_dev_private *internals; > + > + if (valid_bonded_port_id(port) !=3D 0) > + return -EINVAL; > + > + dev =3D &rte_eth_devices[port]; > + internals =3D dev->data->dev_private; >=20 > if (check_for_bonded_ethdev(dev) !=3D 0) > return -1; > @@ -1689,9 +1696,14 @@ int > rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port) { > int retval =3D 0; > - struct rte_eth_dev *dev =3D &rte_eth_devices[port]; > - struct bond_dev_private *internals =3D (struct bond_dev_private *) > - dev->data->dev_private; > + struct rte_eth_dev *dev; > + struct bond_dev_private *internals; > + > + if (valid_bonded_port_id(port) !=3D 0) > + return -EINVAL; > + > + dev =3D &rte_eth_devices[port]; > + internals =3D dev->data->dev_private; >=20 > if (check_for_bonded_ethdev(dev) !=3D 0) > return -1; > -- > 2.17.1=20 Reviewed-by: Qiming Yang