From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40083.outbound.protection.outlook.com [40.107.4.83]) by dpdk.org (Postfix) with ESMTP id E172F5B16 for ; Tue, 9 Oct 2018 09:47:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VRmx5MDNMHl6/zFvGJdh+sEIBFc7RsSQotOAGE76XBI=; b=RzV87f//ixeYzycccavXnZEQkcBuIMWBieVYiov4lAKzM7jTCSPX4ccFXM8q5TfQ0HgmGJqvg5WcbMfEDKpIkqyz4npJFYMo/MjQNRHGwybNsrcB26Uj4f2lAGdrJ1SVB+wXbjLm8wnPDuLOLGn8V8yFZBxLT6v15yuF8zLYuiM= Received: from AM4PR05MB3425.eurprd05.prod.outlook.com (10.171.187.142) by AM4PR05MB3474.eurprd05.prod.outlook.com (10.171.187.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.21; Tue, 9 Oct 2018 07:47:34 +0000 Received: from AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::fdeb:3890:f0f0:2202]) by AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::fdeb:3890:f0f0:2202%4]) with mapi id 15.20.1207.024; Tue, 9 Oct 2018 07:47:34 +0000 From: Ori Kam To: Yongseok Koh , Shahaf Shuler CC: "dev@dpdk.org" , Ori Kam Thread-Topic: [PATCH 4/7] net/mlx5: fix validation of VLAN ID in flow spec Thread-Index: AQHUXzEL1bGd4/vOG0mTbV6nxicwm6UWiiRA Date: Tue, 9 Oct 2018 07:47:34 +0000 Message-ID: References: <20181008180150.39273-1-yskoh@mellanox.com> <20181008180150.39273-5-yskoh@mellanox.com> In-Reply-To: <20181008180150.39273-5-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=orika@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR05MB3474; 6:VVYvAD+DbxT+hzf135098CAnjFstEkX80puP9r6RdhFLfSBYZZfKeShqSHT/8avzrkzUnF8I5SkFiHImSq+67WM+CV2+GjodxKUcqg5s3qeroFBEoIrBGwz3WhaBp1l/NfK6tpWYbJley2hOPACjZ340KAPnBZE/BEUgUPedudZOCFGseqIUfzxjWwPxUpqCgu7L8A5T/41I8inNN5AMMFlg+6N+AWd8iyahv/gcyAGM5RBWDxPUw9a1DUJY34LBS47YCAPNsFA3ywCCfDJNcJ8abpgEAEdk8TCv8X089s60EbdAQmMZ0KjoMbXMoAOBWU+O6YC71dR86s9bqNGG8642TkK4Pi8TmiwFxqVJWfJ/mJ68+GdT5jsVENIAGLIhzeHHu9ZXWx5R6yQCgjfQbUvcDu/OexioPCcmewBl30Rbzrc4JwTF4EMNQ4KbWmd57A0vl5lWxhZ1z+EblrP96g==; 5:rXINa0S6W/upS3F+shjwYyOskJtbkqbYfLUDPdbalY5XyZ8h3lFQEJZQIpZHYosyPNj1aph5elouYxxyNBF5JUBeCSqZyyJzgoqN/llgi57ON+C9WR8sHq8wNblpFLKua5YSoI+cljW7xNHN8es2r5nhdAIPFmzIIzUgdq5Txqs=; 7:/lEotZo61zDL1cqKSRJcgbQHGx8FnA2uQ1G7bmfki1/A9SAg5JgTEZjzlL+BsrcRWV6sFaFLoI7SuszPufBqZM14Dysko+wT3d6t3eBblyRq15dkDZGh+pt9S70kjBQIULPkCqjKd3/jFQ67s/v1tsF/bq1N6RWxVQf7qfsT3HC2aJZspWv0VwLXUVr+qaIqThsJOv7fJKAjImyP/0VgkPxc79o+Y0fkkU5XB8k1j0i/tweK0Cg1fNhBNsr125pc x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: f79dfe40-7bc3-4d42-2f4d-08d62dbb79c8 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM4PR05MB3474; x-ms-traffictypediagnostic: AM4PR05MB3474: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(201708071742011)(7699051); SRVR:AM4PR05MB3474; BCL:0; PCL:0; RULEID:; SRVR:AM4PR05MB3474; x-forefront-prvs: 08200063E9 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(376002)(396003)(346002)(366004)(39860400002)(199004)(189003)(13464003)(6506007)(53546011)(446003)(11346002)(3846002)(81166006)(575784001)(86362001)(478600001)(476003)(2900100001)(76176011)(74316002)(81156014)(7696005)(486006)(305945005)(7736002)(5250100002)(54906003)(110136005)(316002)(26005)(186003)(14454004)(6116002)(8676002)(102836004)(2906002)(66066001)(71190400001)(71200400001)(9686003)(33656002)(107886003)(105586002)(68736007)(25786009)(99286004)(6636002)(55016002)(4326008)(53936002)(97736004)(14444005)(256004)(6246003)(106356001)(5660300001)(6436002)(8936002)(229853002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3474; H:AM4PR05MB3425.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: ztxp2plnYtRkAEcXm0hwYQ1/LXENGIjWHKlFymL/1o88pFU8JXvukSQSoL1oHs1DX+uaXFLNAre9YXAT9zdWBIMemUERCFw0ONbZc9V/gYz6jxFM0zKXnPuO6Ro0RRFs7TWtSsdOslp8MCNzWgoWjrcQRpi4b2MQPgfuGRC8gefSNf6zZSo4O6tesS7DWlF+wKg1ux/mTIerG1OyH9LoVnPDCpc8BlzwpCcCQxwMq+a47z1A3y4XeLGGJtGnGgwLqBkM2uochmi5Pi1AyJuubYPezj3Ic72dczweML3SBrEmEzZNisflvzVbcF1I/IOzTqRRTKqyhKwRK/cj3vqrPotHqwvSUK2fY1d3dWJKq84= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: f79dfe40-7bc3-4d42-2f4d-08d62dbb79c8 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Oct 2018 07:47:34.3706 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3474 Subject: Re: [dpdk-dev] [PATCH 4/7] net/mlx5: fix validation of VLAN ID in flow spec X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2018 07:47:36 -0000 > -----Original Message----- > From: Yongseok Koh > Sent: Monday, October 8, 2018 9:02 PM > To: Shahaf Shuler > Cc: dev@dpdk.org; Yongseok Koh ; Ori Kam > > Subject: [PATCH 4/7] net/mlx5: fix validation of VLAN ID in flow spec >=20 > This can cause crash by null pointer reference. >=20 > Fixes: 4f07e13d6af5 ("net/mlx5: split flow validation to dedicated functi= on") > Cc: Ori Kam >=20 > Signed-off-by: Yongseok Koh > --- > drivers/net/mlx5/mlx5_flow.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c > index 69afd4625..c497cacce 100644 > --- a/drivers/net/mlx5/mlx5_flow.c > +++ b/drivers/net/mlx5/mlx5_flow.c > @@ -1012,6 +1012,7 @@ mlx5_flow_validate_item_vlan(const struct > rte_flow_item *item, > .tci =3D RTE_BE16(0x0fff), > .inner_type =3D RTE_BE16(0xffff), > }; > + uint16_t vlan_tag =3D 0; > const int tunnel =3D !!(item_flags & MLX5_FLOW_LAYER_TUNNEL); > int ret; > const uint32_t l34m =3D tunnel ? (MLX5_FLOW_LAYER_INNER_L3 | > @@ -1037,11 +1038,15 @@ mlx5_flow_validate_item_vlan(const struct > rte_flow_item *item, > error); > if (ret) > return ret; > + if (spec) { > + vlan_tag =3D spec->tci; > + vlan_tag &=3D mask->tci; > + } > /* > * From verbs perspective an empty VLAN is equivalent > * to a packet without VLAN layer. > */ > - if (!spec->tci) > + if (!vlan_tag) > return rte_flow_error_set(error, EINVAL, >=20 > RTE_FLOW_ERROR_TYPE_ITEM_SPEC, > item->spec, > -- > 2.11.0 Acked-by: Ori Kam Thanks, Ori Kam