From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70079.outbound.protection.outlook.com [40.107.7.79]) by dpdk.org (Postfix) with ESMTP id E261F1B431 for ; Mon, 8 Oct 2018 20:02:15 +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=wVyuygalAxEVtht91lBAskK5RL2tnABe+zzrFi9QKrg=; b=ZorUaxKiRqyw7D1OWAiLy5tl01PtU2cFBWGYd8BNlnuIPBWawLSbzvnvKMW03+Ri+RdMsHu/QokhdGLK4aboE9JQq2bcnUPLtTuxoSWxoZHQpNFTvx9b/0fZP1TFgGQXV+z5RmBd1YMxdhi2ETW1UjKKZ6AsFOw3uxWtsDfIH4E= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3979.eurprd05.prod.outlook.com (52.134.67.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.26; Mon, 8 Oct 2018 18:02:15 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045%2]) with mapi id 15.20.1207.024; Mon, 8 Oct 2018 18:02:15 +0000 From: Yongseok Koh To: Shahaf Shuler CC: "dev@dpdk.org" , Yongseok Koh , Ori Kam Thread-Topic: [PATCH 4/7] net/mlx5: fix validation of VLAN ID in flow spec Thread-Index: AQHUXzEL1bGd4/vOG0mTbV6nxicwmw== Date: Mon, 8 Oct 2018 18:02:14 +0000 Message-ID: <20181008180150.39273-5-yskoh@mellanox.com> References: <20181008180150.39273-1-yskoh@mellanox.com> In-Reply-To: <20181008180150.39273-1-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR02CA0016.namprd02.prod.outlook.com (2603:10b6:a02:ee::29) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB3979; 6:5HaSKK2ol/53d1slgKCwXded8K8CcbROVXOSGA/Vl6cQxgi1BdZ99U0JSEMsm0jeVxAL0okzhnWsebxYZyqoox118oMRYKrF3pO8YpfSdAOQHLUWMYl+yZ+ISrruSFzJqfJK/GdNMC+pA7qnFl8h/yPTMeQz/8B3nSVtxw76JQqhh3ub3rw2+Miz3RRFVy7iJVtDFqNGTjHjdDFAudoh+KZqRcKh2GZvL6NEWTO3lDlDRtBpJOjPNkmH0WB+JthFUoNJcBw1WjNlMRZa42SNJ2AYqEHR64yvRh7Be8McJDxC4OKONc0/0FmpkIe3RRWq7Z9qXIX1nqKtt7ZTZXpqbsKMqkszp9cfOwC1FFD9n8kB6dyrPhXKYgNXoxw0uYYxWisIIgRYnRX0I8uiCJLRPMZjl0kb4Zi/Of011XnHjE/+j1M04jqUfAfwstynJuDi8wLaP08pEnwzEnk+1mcYEw==; 5:sV12425gW/xtlpeMiFElkNFQ+ZWW4UQ4oUW9jq+pP2nGkiou1B1xYEHzEANDBHOkFCfrQTA70UEL//Qv0r93oeHJKfBnLWaZGcQJ0Sxp//Li75FsjpYkif5+RvPJSiLKBmov4tB0zJrZF24EYJ0uI+FJkQ9F14gdOuHh1JXK1zQ=; 7:qrDKHQerF6WxMh3fXyqwF+JzRv/8EHTAM4UYiXgjXFu6yoc7JIy1PIHnzdOgdmKP5VsyWyZ4WrPYHgrYIP9q4g8K9b+aAAztQA9vROebjDWkVr93XfVmPv7rehFYv13NhXuqAYPGMz7gruzn9Gs87nwNIgo04v0OoipndVYD25CxPfIrW8F/poDH+FBlGrXq1XCix+VlSp6Fw0FMzWSgZw6IexUvxYiPmYL8qxMY2u7pt9auqz0jbzF/fMvA2T4C x-ms-office365-filtering-correlation-id: 1d9b538d-9e9f-4c9e-dfd1-08d62d482d65 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:DB3PR0502MB3979; x-ms-traffictypediagnostic: DB3PR0502MB3979: 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)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:DB3PR0502MB3979; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3979; x-forefront-prvs: 081904387B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(136003)(39860400002)(396003)(366004)(189003)(199004)(8676002)(2616005)(11346002)(8936002)(476003)(66066001)(446003)(99286004)(14454004)(71200400001)(105586002)(71190400001)(54906003)(97736004)(316002)(2900100001)(305945005)(106356001)(486006)(186003)(26005)(68736007)(76176011)(81166006)(86362001)(52116002)(575784001)(5250100002)(81156014)(25786009)(7736002)(36756003)(5660300001)(6116002)(1076002)(256004)(3846002)(14444005)(37006003)(4326008)(6862004)(6506007)(478600001)(386003)(102836004)(53936002)(6512007)(6436002)(6636002)(2906002)(107886003)(6486002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3979; H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: CHvv5Ki3V91Xj0XlHBFtVMm5sthPthRbPXF7hbZDOZkxTMocykS05+6ohFuU2icDucTvOmR84pG5buXPDAdBnU0VVIU47gDCuL1uoM/iCa+H4Pejq4rlJI471pgbhPMTAVVXdCs8Z3jexX/i6JpEt0JgO04vQFh4ihgt6bO1gXYNLkGxFTMp5yP3DnVkPd/jZpL9ti2n6pcVWVv+v5VWYB4ScoFV16VI3BG1IMEl7zNRmcQLYhIcFEQi5835xU3/CGIFurasE2HIZsfEKA+RJ7nNV8vIcUmTQEdnL7GtlCe/c7miozqcnpU/cH91bWkoImjqffTdRbcJCEgJcN/xLLcYjLmncJIB+isdodtwZ+E= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d9b538d-9e9f-4c9e-dfd1-08d62d482d65 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Oct 2018 18:02:14.9055 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3979 Subject: [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: Mon, 08 Oct 2018 18:02:16 -0000 This can cause crash by null pointer reference. Fixes: 4f07e13d6af5 ("net/mlx5: split flow validation to dedicated function= ") Cc: Ori Kam Signed-off-by: Yongseok Koh --- drivers/net/mlx5/mlx5_flow.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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_it= em *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, RTE_FLOW_ERROR_TYPE_ITEM_SPEC, item->spec, --=20 2.11.0