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 57549A00BE for ; Tue, 29 Oct 2019 09:33:08 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 27EF41BEDD; Tue, 29 Oct 2019 09:33:08 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 1D4C31BDAC; Tue, 29 Oct 2019 09:33:03 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Oct 2019 01:33:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,243,1569308400"; d="scan'208";a="211061302" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga001.fm.intel.com with ESMTP; 29 Oct 2019 01:33:02 -0700 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 29 Oct 2019 01:33:02 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 29 Oct 2019 01:33:01 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.213]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.63]) with mapi id 14.03.0439.000; Tue, 29 Oct 2019 16:33:00 +0800 From: "Yang, Qiming" To: "Ye, Xiaolong" CC: "Jiang, JunyuX" , "dev@dpdk.org" , Chas Williams , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] net/bonding: fix segfault using invalid port Thread-Index: AQHViuThhmsqij44m0ivUL/05k704advjuIAgADgRACAALtLMP//fR2AgACpaEA= Date: Tue, 29 Oct 2019 08:32:59 +0000 Message-ID: References: <20191024205551.26273-1-junyux.jiang@intel.com> <20191029030406.GC12923@intel.com> <20191029062559.GH12923@intel.com> In-Reply-To: <20191029062559.GH12923@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNjY5YWYxMDItMjFhYy00NDAzLThlY2MtMjExZWJmNTlkYjFjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiSm1LUXIzSG1TbFwvRUUwMmFQTTdSQ25WcjhpTFhXZUFmUHRkSVpHTjVZeFA1dUN2TzlYU01tMzlTVnpOXC9NZzZWIn0= 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] [dpdk-dev] [PATCH] net/bonding: fix segfault using invalid port 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" Thanks for the information, got it. Qiming > -----Original Message----- > From: Ye, Xiaolong > Sent: Tuesday, October 29, 2019 2:26 PM > To: Yang, Qiming > Cc: Jiang, JunyuX ; dev@dpdk.org; Chas Williams > ; stable@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] net/bonding: fix segfault using invalid p= ort >=20 > On 10/29, Yang, Qiming wrote: > >> -----Original Message----- > >> From: Ye, Xiaolong > >> Sent: Tuesday, October 29, 2019 11:04 AM > >> To: Yang, Qiming > >> Cc: Jiang, JunyuX ; dev@dpdk.org; Chas > >> Williams ; stable@dpdk.org > >> Subject: Re: [dpdk-dev] [PATCH] net/bonding: fix segfault using > >> invalid port > >> > >> On 10/28, Yang, Qiming wrote: > >> >Hi, Junyu > >> > > >> >> + dev =3D &rte_eth_devices[port]; > >> >> + internals =3D dev->data->dev_private; > >> >Have you build success? I think we need to add (struct > >> >bond_dev_private *) > >> for force transfer > >> > >> dev_private is a void *, an explicit type conversion is not needed her= e. > > > >OK, I saw the original code used. > >- struct bond_dev_private *internals =3D (struct bond_dev_private *) > >- dev->data->dev_private; >=20 > The original cast is redundant, there is a patchset from Stephen before t= o > cleanup these unnecessary casts. >=20 > http://patches.dpdk.org/cover/53858/ >=20 > Thanks, > Xiaolong >=20 >=20 > > > >> > >> Thanks, > >> Xiaolong > >> > > >> >> > >> >> 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; > >> >Same as before > >> > > >> >> > >> >> if (check_for_bonded_ethdev(dev) !=3D 0) > >> >> return -1; > >> >> -- > >> >> 2.17.1 > >> >