From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140084.outbound.protection.outlook.com [40.107.14.84]) by dpdk.org (Postfix) with ESMTP id 439E92BCE for ; Sat, 10 Nov 2018 10:59:26 +0100 (CET) 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=UBiMf37nzO8NlsK/Tgq25Ir2t5hahY/cW2vcpewTSnI=; b=P1U7o1nEc51NN6nvn+5PyrzQmaNDIMLT1SeETXY0MzubOBRJhUaheMS5lJ0oWQGTFp034YAIpVbNZQPfMU1c7S9T99HB3NkQoc2AFviZb8PZ3Tbf9yz+ZuEWHZXVQvlhFMCiVR2wct175W5jNfALm6xy9zjAg+bQaoYCYfEToq8= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.186.150) by AM4PR05MB3250.eurprd05.prod.outlook.com (10.171.186.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.21; Sat, 10 Nov 2018 09:59:25 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::544b:a68d:e6a5:ba6e]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::544b:a68d:e6a5:ba6e%2]) with mapi id 15.20.1294.039; Sat, 10 Nov 2018 09:59:25 +0000 From: Slava Ovsiienko To: Shahaf Shuler , Yongseok Koh CC: "dev@dpdk.org" , Slava Ovsiienko Thread-Topic: [PATCH 1/3] net/mlx5: fix buffer allocation check in rule cleanup Thread-Index: AQHUeNwPk5GfgS5PhkubI3ARWMkxnQ== Date: Sat, 10 Nov 2018 09:59:25 +0000 Message-ID: <1541843951-31708-2-git-send-email-viacheslavo@mellanox.com> References: <1541843951-31708-1-git-send-email-viacheslavo@mellanox.com> In-Reply-To: <1541843951-31708-1-git-send-email-viacheslavo@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: CWLP265CA0342.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:5a::18) To AM4PR05MB3265.eurprd05.prod.outlook.com (2603:10a6:205:4::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=viacheslavo@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR05MB3250; 6:NLRiB5AxUHeX6vytS45RPi1PBG+jeWFzseRBNrfVxPKBMQnkBMz1XiC/eqhXCHJG6YqBI1gxbA57gnbd33ameI+lLBcbwqSKcPMDuMHjVXlSgvjPlHd28izJOBMmZ1B6EScte23jw4H2WmBKp5eUaWAvETBibyucOlVUOEbCZ/tFc4WTECeTIzD7kExa8v45pqfHVLJA6eW5ZY3pQjWlQ9NG/z17tePs05V0obMbqJRO+x1ZnMgF7hZqhFL0aYx5pd70MT/t155bJ/jwKaBpD2Im0mtH9sMOnk/70PTvr1hLxRwsYTlxCOR2VrdN74MRMZV7hvQfRDxF0kXYOe9BsGoH5khc1nvfS7jvecnn2x4eY0W45Wk4xkjInqG6liBLHTTt7yq/2p3z1e8weTd8xjqW0unkfqGB8fzL7rfQ8b8oeWHUMQ/uxfnqIAZPYJxhQRu2QFN/pBeq0s2yP1n84g==; 5:knwOWzRrL5Jb6aKJwGpl12nXAnme3sJeJCSW1k29s4Xx5nBotgoAlYwyVhHP82k4UIzxkv6DLgzI+iGFxojmtVCiS53MoIOnEgrsnov8+T7i9+oI0KnC4VklY6A3ucZJevVWFswTRl9EsNJ+nU01gZv24wGgwA8Z6tcxmOrj41M=; 7:UFgCSePQwrEXz1nIzP41pSNUyr256luiYfVotux6qVfR33W4rWquuJfBvIg7qd1ux8lwDIPnFVyzHW8Igdn/xpHddUY/g0lMNxtAOIG/mG7LV5wzB4d6k04sEQ7/9Fc+UttWCmejEAWXUYKGNcudSQ== x-ms-office365-filtering-correlation-id: 864e44d4-dbfd-4281-0502-08d646f3320c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390040)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM4PR05MB3250; x-ms-traffictypediagnostic: AM4PR05MB3250: 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)(3231382)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:AM4PR05MB3250; BCL:0; PCL:0; RULEID:; SRVR:AM4PR05MB3250; x-forefront-prvs: 0852EB6797 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(376002)(39860400002)(346002)(136003)(366004)(199004)(189003)(2616005)(11346002)(6436002)(476003)(486006)(4326008)(7736002)(2906002)(3846002)(76176011)(186003)(54906003)(105586002)(6486002)(6116002)(446003)(305945005)(25786009)(110136005)(66066001)(386003)(6506007)(14454004)(102836004)(36756003)(52116002)(81156014)(97736004)(81166006)(6512007)(106356001)(8676002)(2900100001)(53936002)(107886003)(316002)(478600001)(71200400001)(99286004)(8936002)(68736007)(14444005)(6636002)(256004)(5660300001)(71190400001)(86362001)(85306007)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3250; H:AM4PR05MB3265.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: cJZ236l01wQZc11vmao5BcxHyUtuMtgaaR7SBoUERdYfqVO89FUftTjZxtUju2Ucf22fY3uIF9uXPiZaRsan6IzS03blxbplvurrLRgXM78p6byTD90hFPURWLp8mg+UnSJ/cahRMyMlX/LVREcM2vd/776sFriUIWj2s4tPAIsaSoE7mtTlI7enXanU0B6c82WvEhUlT/0LvCRwQLgqpiePj7+80Kvr2O7EM68wZboWc3MoKrQC+yjtS29VCHhnI/ATI8CU4/JuSfVQAE8/94JpAXXCJoEcFxSD6yhV3I96sjAmtgHk5gN9SJ7OSTHU181NWuW7miIiUt3k5JNdNJFDkRINOjeeNoFs8XU5vYc= 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: 864e44d4-dbfd-4281-0502-08d646f3320c X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Nov 2018 09:59:25.3261 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3250 Subject: [dpdk-dev] [PATCH 1/3] net/mlx5: fix buffer allocation check in rule cleanup 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: Sat, 10 Nov 2018 09:59:26 -0000 The Netlink message buffer is allocated and there is the typo, the other pointer is checked instead of returned one. If no memory is allocated and NULL is returned by allocation routine the bug causes segmentation fault. The patch fixes typo, returned pointer is validated. Fixes: f420f03d6772 ("net/mlx5: add E-switch VXLAN rule cleanup routines") Signed-off-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_tcf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_= tcf.c index fb817b2..ba0674a 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -4226,7 +4226,7 @@ struct tcf_nlcb_context { vxindex =3D ifm->ifi_index; cmd =3D flow_tcf_alloc_nlcmd(ctx, MNL_ALIGN(sizeof(struct nlmsghdr)) + MNL_ALIGN(sizeof(struct ifinfomsg))); - if (!nlh) { + if (!cmd) { rte_errno =3D ENOMEM; return -rte_errno; } --=20 1.8.3.1