From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8D60FA0032; Wed, 14 Sep 2022 10:11:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 30D164021D; Wed, 14 Sep 2022 10:11:09 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id A17B940141 for ; Wed, 14 Sep 2022 10:11:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663143067; x=1694679067; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=VxOWva8pFy/0Xov1jTq9/0axh7Vg1lMqrnqkALywq9g=; b=CPXYTXe7ctQ2AF+taN3i8TmbkWIUNYXnxBZhtlREv/btV0j3cfUq0Za5 KpvkeHnidX6rRPsU4cXzZE99EH5ic9jWg3p7Yo9MgyIrz9ky7/AEDGaq8 phqpVLIysMH86+xkSScP4HhBG+MrMarwECnu2k+IANEfxOE+AJSE/e3I7 pTGW6uV8Q1JL+brJJGIC+XeZcjFsNX/UbGgv5Ab11jk0BmKO6vbz5wAAm MtjTNcJZerVFePSW4kBlaoWUxnf8nUc/R0HKfxpxPYJ026wZCPvy99VDp ILrfM3jnBrFbODDR7TnJl+KaNldqOyufEUeoKM25kyj2Ee+zqzT7M9kkY w==; X-IronPort-AV: E=McAfee;i="6500,9779,10469"; a="278755031" X-IronPort-AV: E=Sophos;i="5.93,315,1654585200"; d="scan'208";a="278755031" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2022 01:11:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,315,1654585200"; d="scan'208";a="945419911" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga005.fm.intel.com with ESMTP; 14 Sep 2022 01:11:05 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 14 Sep 2022 01:11:05 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 14 Sep 2022 01:11:04 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Wed, 14 Sep 2022 01:11:04 -0700 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.171) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Wed, 14 Sep 2022 01:11:03 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zp6yiP7jwnRwWKSlQqxwwsn7eH6Py8UkORNFZX1JQDGgzgSG5wPA5sJU2slf9bvQcmGS0R87r8f8D20DdamXSjbcPAoBdYEWwoAUJ/cLKSfX8Vvcez27gthcFklsIHzNYXcWIkdLWHhJH1+2J0HdkzljEHtiWg+ninZTLr7s9gIZoiLvd2Q9rAfUwCaFWIE/ii4iqrtFqN+Cxvl2JiYvou9pX4z00aNJpBItSJ6smU2hmhqWR5FoPIJPd4OzNrlAnvbkCT7aobqDgwUAO87r1VXR8Lv4Ud+8B+JwkrhVwBurT5loLdnbyyqxxnShvbVs1MCCcnNiMyfMtfGJ7/U/Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bR16RLo3nvZEdMuIFXwIbf8DUB8YBMy/TW8Mmz9JDL4=; b=c5ZKC89X2JBQCn85G7eRWp/1u2u3xxl2n1IpP93HOZWFzoR0KA+Yv0yquni8Xw25Mq1sYcEPFZBvNGjk0dXcemHNeXfK2fyhZo0zWBtu1UwS7s5dAr4ojN+SdUT2AA66Z/4HMlfxKLLND2vlTuOehMJnB7K0VJLpu93ItMf4qTh9RIJ0XZ89BXa8L6JIG4DA5/fH2R/W0MtLGh7CSF4UUHV2rMCMSN3cd4qGFQbid8BjEEdOw/7SIJfKIFPeJJxQ0pYOavARrJ7pp3hrBMENvKNoINa6BCJjnuQMJ2e3GAZu4U8EZ8VHlDeg0uNjOBfAaRlCzsdYTg9l3b2eA0FTAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from PH7PR11MB6056.namprd11.prod.outlook.com (2603:10b6:510:1d4::20) by PH7PR11MB6676.namprd11.prod.outlook.com (2603:10b6:510:1ae::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.22; Wed, 14 Sep 2022 08:11:00 +0000 Received: from PH7PR11MB6056.namprd11.prod.outlook.com ([fe80::3c9c:731d:29d4:3849]) by PH7PR11MB6056.namprd11.prod.outlook.com ([fe80::3c9c:731d:29d4:3849%4]) with mapi id 15.20.5612.022; Wed, 14 Sep 2022 08:11:00 +0000 From: "Xu, Ke1" To: "Zeng, ZhichaoX" , "dev@dpdk.org" CC: "Yang, Qiming" , "Zhou, YidingX" , "Zeng, ZhichaoX" , "Zhang, Qi Z" Subject: RE: [PATCH] net/ice: avoid out-of-bound access Thread-Topic: [PATCH] net/ice: avoid out-of-bound access Thread-Index: AQHYwZhIMBCow1iGV0e29++mBU5ybK3enREQ Date: Wed, 14 Sep 2022 08:11:00 +0000 Message-ID: References: <20220906022859.159925-1-zhichaox.zeng@intel.com> In-Reply-To: <20220906022859.159925-1-zhichaox.zeng@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.6.500.17 dlp-reaction: no-action authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH7PR11MB6056:EE_|PH7PR11MB6676:EE_ x-ms-office365-filtering-correlation-id: 39321c85-5d94-4684-1e4f-08da9628a8f6 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: D+9Fz9mZGRareVI5MS9YYVGlhy2xBRFSUGLRAOPGfr/9kMECIcwG2F4GJXM7pz+rs/EJq8tPdzjawzpVnUsMc3p0QwxnqIS7wofpzj9iPXWL55OHULbWsqGYEHonU7ESFfhk3LK2LViA0q60EJ0rbgDvSU9NawkgtNw5yfuKZIShpV4NbSHZKpzdD2+ose3epF5orjfGswWLHcDpJaTfPKoIiC86IU93OsoZJXe2wXf9yDiy6bKZbTf+dTTZocs/lFoV6DWRBX56CX0CfJAzTByQZaiF3J5CzeuKC+df6/t3NCkyPKEleJHXC8aH2eGrOEY6Oif0RPnLHpv9bZNRdXEouUsKHJCBFRV5+/eXNbpHUwx06W0m8EsZfvXAF/l3URTOv+F4pezSSfvugHmgLV9JozGPa6SMGQA49UqWrjy81oDl6EecXg9sR6Fr2nF281etHeNYcXyM1+01aDuwQc08gMiRenav+MtPpGfpYSeDeq3HKptTP2htmL51OLvrsyHJvjSDJOY/rnruRnBQ+NotB+oiwfNNPm3qVStCxPmXBM5Dv6tdX4YLunkcI6Pb1JqdtBd8+qgpj3BESNBXQhXMiOLcL5rqBkEocASG70936ut+qgx/iV8HJ2yIxzYzqpHx90Gpl1l1Ec5T3EQWIVJj4FsLspwKNE6F+p4rRACnBeYDwE6L8NynFtvKbmbdx6NNNIfXQIOX1glGTS3mMDlQKk2fNVocjKlSrNbkhWqlGX9gLde13BZbX+ci2A/waJkjDnNhuGJfoWANCxuc2Q== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH7PR11MB6056.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(136003)(366004)(396003)(346002)(39860400002)(376002)(451199015)(122000001)(8676002)(107886003)(71200400001)(38100700002)(66446008)(52536014)(66476007)(110136005)(66556008)(66946007)(76116006)(64756008)(9686003)(86362001)(4326008)(26005)(82960400001)(5660300002)(6506007)(478600001)(55016003)(2906002)(53546011)(33656002)(186003)(7696005)(54906003)(38070700005)(8936002)(316002)(41300700001)(83380400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?CTQHkjrCNQf2LBsVo7koz2l3Dib8IUWJVueVyCNhqpd2fBJhPlKEH02/R8sj?= =?us-ascii?Q?MzdCi3zdU92JmMGwyXWy2a7C+aVrULjS6GeBEyAjaHHvt0LeCFsmlh6mp3MD?= =?us-ascii?Q?+K++ov7jY7KLa7dymzTq5T1LhCMkUabeNPcSs+pfiffhCQsKsU3davHCrqRQ?= =?us-ascii?Q?YDKHOXfU8yIaEEvtVuNXcvhEd9qray7puDYXDxCkzfvDrTcNa2FVHn3aKkHz?= =?us-ascii?Q?owauJLicl8YztnCLeYXWh6+1XNarPX2/gEzYOpB38MAGcYHzO9hT7mUSbnkJ?= =?us-ascii?Q?xXOW+vY67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ah?= =?us-ascii?Q?D6wzQd6fq8DYWswzUMVWuOil922XNUq6BnJvO8avUPTei2bwGy7Qwji7/Nbu?= =?us-ascii?Q?NaMRTwZXHv0LpZ1s7tujp+bhbQZCFMgQUQ4jfBfs8Hq/8nA8CIF++wAdLd0u?= =?us-ascii?Q?h+r16+zwgm2WPx0o/dxh9p2bS83mWQq1Rlr7M6XP8h0nSxRKevvrPYoObtmZ?= =?us-ascii?Q?9YP9xJTktaWmgKn+S9gYuklUsbxqeex0T+U6EzuuvSuBNLoRZrNZu6jfop5m?= =?us-ascii?Q?t9celykowiKBq7QnVtMQhhRI4zfJv60f/lH8yvJyoRwPYIAUDus+NNhngg58?= =?us-ascii?Q?NZV5a0XhVcF6LrEJh8a1iiRG2zagU99jmLSVGu5fsfN+6ZBOYCXhkky86hJJ?= =?us-ascii?Q?5jlpx4QqxzKPa/N4QSU=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH7PR11MB6056.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 39321c85-5d94-4684-1e4f-08da9628a8f6 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Sep 2022 08:11:00.3594 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: X7HXm2otywwDWyKaJBj34WtNn1zVgOStlzzw8n0GULHEEC9eKKXUwbbMuq27wO4h6PlQ0qpjYqFkcTwNPsLx3Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB6676 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > -----Original Message----- > From: Zhichao Zeng > Sent: Tuesday, September 6, 2022 10:29 AM > To: dev@dpdk.org > Cc: Yang, Qiming ; Zhou, YidingX > ; Zeng, ZhichaoX ; > Zhang, Qi Z > Subject: [PATCH] net/ice: avoid out-of-bound access >=20 > Add judgment on 'ethdev_port_id' to avoid out-of-bound accessing the > 'rte_eth_devices'. >=20 > Fixes: 6f8fba7e437e ("net/ice: support represented port flow action") >=20 > Signed-off-by: Zhichao Zeng > --- > drivers/net/ice/ice_switch_filter.c | 4 ++++ > 1 file changed, 4 insertions(+) >=20 > diff --git a/drivers/net/ice/ice_switch_filter.c > b/drivers/net/ice/ice_switch_filter.c > index 240fa10750..59fb31aa9d 100644 > --- a/drivers/net/ice/ice_switch_filter.c > +++ b/drivers/net/ice/ice_switch_filter.c > @@ -1631,6 +1631,10 @@ ice_switch_parse_dcf_action(struct > ice_dcf_adapter *ad, > case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: > rule_info->sw_act.fltr_act =3D ICE_FWD_TO_VSI; > act_ethdev =3D action->conf; > + > + if (!rte_eth_dev_is_valid_port(act_ethdev->port_id)) > + goto invalid; > + > repr_dev =3D &rte_eth_devices[act_ethdev->port_id]; >=20 > if (!repr_dev->data) > -- > 2.25.1 Tested and passed. Tested-by: Ke Xu