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 98B61A04DD; Tue, 26 Nov 2019 16:30:18 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F13282C60; Tue, 26 Nov 2019 16:30:17 +0100 (CET) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150089.outbound.protection.outlook.com [40.107.15.89]) by dpdk.org (Postfix) with ESMTP id 8362F2B88 for ; Tue, 26 Nov 2019 16:30:17 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UMc6+JOzN6uq8h4momoJoJZ6FiMX2+mWGpmDK+/xtOs6K2riFzkZzjJzQ78/Ab1Z/a+bNZWfOT4KQXz2WDV2Lqa6BKri8J2tAPcN8eYaobllpIEm44yDqVl/gGJf5wcvYNrq1tlpgtM6qKLupluOjX1gWX9KEz1JJwvOAVfWud307tkO6ymg0vUx3TU5KSUcZ7ocu7VXGcstQxwbQLluWPAVGeJbkoMj3DX2uqzwiJOfh++hzDz3qzmlxM6d/0MjhZvQrG8gLUjo1xoPyDLYuNq0PUbtkBf8epD27cNoxAdF4yQqix4QBOYchmLCwZ0UB0hCJGHVxRc3Ud9qVbkBtw== 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-SenderADCheck; bh=RopnWRS3v8D3B4AfDVyVErKsl5mTbOTr3Z0oc1yr5Lg=; b=n07TS4UPz1/z9uMUI0RwEELLiwy75Kl53hvS4INFHfPRX3vBtGY9Kf+cYVFHBHCgxVh9FwQmRfGpOKHybHW0Tvi0nOYN4c5lq4lDlq9nVOaDmA7hRPxwj5yR2iT75J+Ldwla1uyBERxk0uRL8psYcq+og+2nvlmoqLxdNaIwqmFQDfws9dta6G0xxUXvfQOSfp1GuVFsN2HgHMmH9nBhVxJyA0bHJ6/npTQJuiCJ3+dOElcYvNY1pY1AgraZ8QCnmcPuDZlim4sMGFlFhYfN7vrUDEmDp1mPRhpqdfi7J+35n2dJ7i7GfeVL7KWNNTfjLbLqXawvleepnyYLw5LtZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=RopnWRS3v8D3B4AfDVyVErKsl5mTbOTr3Z0oc1yr5Lg=; b=BTfIhSz7rKsyn/p8/mNA14YHg1zOm/9k86GwYIL1TzAqufd4aoUTjn8V/bXjK6fyqDvP9QR7hTfEVnVYK/UtKsMkod6oUkjCZHM1rn0hI0qcB0K22c/uvVN0NnSCBfnd4MTkNHEz9qyUwClnMU7/UfSTK1nhRHzzg8sM6V721Uc= Received: from DB3PR0502MB3964.eurprd05.prod.outlook.com (52.134.65.161) 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.2474.22; Tue, 26 Nov 2019 15:30:16 +0000 Received: from DB3PR0502MB3964.eurprd05.prod.outlook.com ([fe80::a850:bac9:c90f:f2f5]) by DB3PR0502MB3964.eurprd05.prod.outlook.com ([fe80::a850:bac9:c90f:f2f5%6]) with mapi id 15.20.2474.023; Tue, 26 Nov 2019 15:30:16 +0000 From: Raslan Darawsheh To: Suanming Mou , Slava Ovsiienko , Matan Azrad CC: Ori Kam , "dev@dpdk.org" , Jack Min Thread-Topic: [PATCH] net/mlx5: fix GRE key handle before GRE header issue Thread-Index: AQHVpGMEpmRAeDx+C0i+IIitXpXl9aedk/gA Date: Tue, 26 Nov 2019 15:30:16 +0000 Message-ID: References: <1574777315-10627-1-git-send-email-suanmingm@mellanox.com> In-Reply-To: <1574777315-10627-1-git-send-email-suanmingm@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=rasland@mellanox.com; x-originating-ip: [212.29.221.74] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: bcc493f6-045a-4b84-fa58-08d7728589e2 x-ms-traffictypediagnostic: DB3PR0502MB3979:|DB3PR0502MB3979: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-forefront-prvs: 0233768B38 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(346002)(39860400002)(136003)(366004)(396003)(189003)(199004)(13464003)(446003)(4326008)(33656002)(66476007)(76116006)(99286004)(64756008)(66946007)(66446008)(66556008)(71200400001)(14444005)(6436002)(305945005)(86362001)(110136005)(3846002)(25786009)(478600001)(71190400001)(186003)(14454004)(6116002)(52536014)(229853002)(6636002)(7736002)(316002)(11346002)(66066001)(5660300002)(102836004)(26005)(107886003)(76176011)(81166006)(74316002)(8676002)(9686003)(2906002)(81156014)(6506007)(55016002)(53546011)(256004)(8936002)(6246003)(54906003)(7696005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3979; H:DB3PR0502MB3964.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: eM9aExpTmAfrjL6hnRNxom8y1dZPUhrjZm01wwXpArmSe+Dxi57RYFrIBlKS0Bg3yjItBxf3k48SadjBzwW5pmaz+LtdQyDoYLRdzlNhIhybB9wAPMZrlA+i1U8NKtgydkvkM2KRJ3wowk6NNvmenob4bHv9vQ+5sHLE0ALEpzsN2NzWrjmyqqrJ3eCGsA56LYj6FxDdehYOz38t5BQo1WYN/nEQfrF76dfbmfpA4o9zIAHOxkd5hev4nj9xPXl96KJ6/68kTrvSUQ1t9JwkyFxIRbpFHgTA/ZetV83o/gyNr4uDHjmXDw3EXW/Bcr69Vxvtbi/U9Hl6L0uSbqVSGHQBZ4DaWnrnTL9LRlm5ccQngcdXq2ycpH+Zk7M51iy+2cmKpe5Y3mzkdJiI+Wcms592WndPLp2qtzenRPYiS268N/4KNOKqXuZlHp/mBIf0 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: bcc493f6-045a-4b84-fa58-08d7728589e2 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Nov 2019 15:30:16.3826 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Wrbx4RLVmNh8YfKwBKIDkT4eOFAzpptQ0ASrcKtwTyUZeqQ65cE5hzKfUnW+u0a0Gx8PkocELCZgXnH7n0Iybg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3979 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix GRE key handle before GRE header issue 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, > -----Original Message----- > From: Suanming Mou > Sent: Tuesday, November 26, 2019 4:09 PM > To: Slava Ovsiienko ; Matan Azrad > > Cc: Ori Kam ; Raslan Darawsheh > ; dev@dpdk.org; Jack Min > > Subject: [PATCH] net/mlx5: fix GRE key handle before GRE header issue >=20 > When set the GRE item, GRE key should follow after GRE header, or the > header gre_item pointer used by the key will be invalid. >=20 > Currently in the mlx5_flow_validate_item_gre_key() function, the header > gre_item pointer is access before checking if the key is after the header= or > not. Once the key item is before the header, invalid gre_item pointer acc= ess > happens. >=20 > Move the gre_item pointer access after the GRE header check to avoid the > crash issue. >=20 > Fixes: a7a0365565a4 ("net/mlx5: match GRE key and present bits") > Cc: jackmin@mellanox.com >=20 > Signed-off-by: Suanming Mou > Acked-by: Ori Kam > --- > drivers/net/mlx5/mlx5_flow.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c > index 65a0e65..5c78ea7 100644 > --- a/drivers/net/mlx5/mlx5_flow.c > +++ b/drivers/net/mlx5/mlx5_flow.c > @@ -1998,8 +1998,8 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > const rte_be32_t *mask =3D item->mask; > int ret =3D 0; > rte_be32_t gre_key_default_mask =3D RTE_BE32(UINT32_MAX); > - const struct rte_flow_item_gre *gre_spec =3D gre_item->spec; > - const struct rte_flow_item_gre *gre_mask =3D gre_item->mask; > + const struct rte_flow_item_gre *gre_spec; > + const struct rte_flow_item_gre *gre_mask; >=20 > if (item_flags & MLX5_FLOW_LAYER_GRE_KEY) > return rte_flow_error_set(error, ENOTSUP, @@ -2013,8 > +2013,10 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, > int32_t priority, > return rte_flow_error_set(error, ENOTSUP, > RTE_FLOW_ERROR_TYPE_ITEM, > item, > "GRE key following a wrong item"); > + gre_mask =3D gre_item->mask; > if (!gre_mask) > gre_mask =3D &rte_flow_item_gre_mask; > + gre_spec =3D gre_item->spec; > if (gre_spec && (gre_mask->c_rsvd0_ver & RTE_BE16(0x2000)) && > !(gre_spec->c_rsvd0_ver & RTE_BE16(0x2000))) > return rte_flow_error_set(error, EINVAL, > -- > 1.8.3.1 Patch applied to net-net-mlx, Kindest regards, Raslan Darawsheh