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 19ADAA0C4D; Sun, 5 Sep 2021 10:46:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9690940042; Sun, 5 Sep 2021 10:46:18 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2089.outbound.protection.outlook.com [40.107.100.89]) by mails.dpdk.org (Postfix) with ESMTP id 976984003D; Sun, 5 Sep 2021 10:46:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q0EkdrPBDyZwwiL1VLzKRHVUcA8qYU8AXsC8sE93q4SmJc6Q911HDfcZWBoMEPtfXyDyOzHTuYJGEFhxZ6tGT86NugEFfgjxsBJVWAnZdJwWpVqfsJhhviQOMqbI+ThSQZS47rdjtE78qIOtotWwGzhoBrE0vGaAl1ITpmVg3twPAd5DS05H15992Q5EwhuNSCEkgb2TDI12so9vgOTdk/Dkh8nGLkIBGSfSSSSsJKhupPGtmUgN2sKs4s1JR2hAeWMSoANKHrpSmpn70vSbY2EoKLHjz7LTCUhRnUJfE+F0zfF6b848B9xifuFqP2VK81gLpKYIJQ9vX4JTexO3HQ== 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; bh=r85ueJEwGL10XKoMjSAQQyZl4QEWM30Ls44lKGVFXfE=; b=RCQvN4f/3QDRGo0nU9G13hWya1TixTeHzBaZlCy+lE52OkLbrJ2K1rJQF+Rdy3XKo0mhNXoZFIII5fSGTyCnZ6W0CICAH75okEBaQbkiNzint4fU79wYi+a8RhjKFaPl5axjUSWg9kxG85LmNUkegDYP/wRMLe0LNqssip0PHtLuqC+/EJ27Ubgj4wJ3rDFm5hxvOAGOl25ZFiR+KHY9MT9PmlYM6j44ldAK5wbSh4kyp+4ds8ivMyBdFf66BLkf39cVraVZoKBgJyddHYQPnOfAnhavHXS3+lugJibuB+RFCkuk6ELBd2/xDX7wiGUMBB2LRHd5D8SdPQYys0Z4bg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r85ueJEwGL10XKoMjSAQQyZl4QEWM30Ls44lKGVFXfE=; b=LaURK7NM+8f/0oIrOgftvj8/aVBuobInjDLLWjuWADz6Pr92ql/jGWgK2x43uewXnMhzi0bngT7uvyFeT6SwgcZI9qCE4h6Svau0iImfkyBbAkcF7IhFnc6j+yBDow8NhnrqDclit3Jrb8L2a2PVQLGQCH0LEJ4jWZu6PU3/8OmzspFjxvHIOFxLhUqmIG/z/T5tK93cBYXVNsg2McFKtByRG6TJufQFi1/R86cv8jEKnzNPR7JiWts2HCFl2oeUvBKvMTqJh20evhivLVlhpUpmugwHV6kXO4GgbQJTIvOUrWaq+5Jpa6SC6ErwgtaVQJtjhxdUrjlRi46Q/Rvhww== Received: from DM4PR12MB5054.namprd12.prod.outlook.com (2603:10b6:5:389::24) by DM8PR12MB5479.namprd12.prod.outlook.com (2603:10b6:8:38::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.21; Sun, 5 Sep 2021 08:46:15 +0000 Received: from DM4PR12MB5054.namprd12.prod.outlook.com ([fe80::1938:4176:69c6:d14d]) by DM4PR12MB5054.namprd12.prod.outlook.com ([fe80::1938:4176:69c6:d14d%7]) with mapi id 15.20.4478.025; Sun, 5 Sep 2021 08:46:15 +0000 From: Raslan Darawsheh To: Michael Baum , "dev@dpdk.org" CC: Matan Azrad , Slava Ovsiienko , "stable@dpdk.org" Thread-Topic: [PATCH 1/6] net/mlx5: fix shared device context creation error flow Thread-Index: AQHXnqgdA1R+cZWtvUib1J7GQ3iSZ6uVJTcQ Date: Sun, 5 Sep 2021 08:46:15 +0000 Message-ID: References: <20210831203732.3411134-1-michaelba@nvidia.com> <20210831203732.3411134-2-michaelba@nvidia.com> In-Reply-To: <20210831203732.3411134-2-michaelba@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 67d5ee26-7a40-4fe4-7499-08d970499f30 x-ms-traffictypediagnostic: DM8PR12MB5479: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4714; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Weipb1JPD9PfU1zoPGkL8wNwdhXNFvGgxnCP/YCb73nq9ZZJIY+Q2y5vH1rTVy1ef22qrFT3iaSX+t7LhW9T9Hj2T66LzqzvtkYq3X7N2PoNYbOkCFV9C3LJRlCN8hA8FJcoFOfzhiwYPnrfTz7KZsiHp/IPUrwwwSmhlS4bDu0q/2ZtD924fz6QHvwY7iohGSI/JPlFwew81ZRr409L9BvZjfO6OycwKBCWB2GZD6XzSvDcIoA4fiJg60mmY2ik37MabojWuUz/7JP/pTgkwXbO9o+pG9Udlacrp9QJZZU3lYYdqomNVIoFV9U3+/r1CIYjdMcRe2rt6r9x9kMGq7CygrSAFXrHxIYZH1i1YU6iUoE/B79Ll3wm4bExH7IsJIfxditRsXPbcbI8UNKfd0P5vUGWlLupr2hkwdxV8tUgWEAvl+SCxuGY+nx2xv6kvodl0S2dEc/zMt43g0mDYGSZ9Tpj9zA/MpMhIQQeO7Ek0QrJLdQx0yrKROm1XpZaeYO6nmZj3sQVr3KSPMsWv8qOfb/TFZU7uWT6iHDGFrP9qczZGIHZgHqULn7iIkIUfEyneyTHaSRRW03y/LmJAw5fEbeIZRx9oR4Q3iNpY5lvlxZdwIWAESmIDYwQhj6j4GCwwwyjWbJPzX/9H7DrwPZbzfULRa0IFvBvgSrPWvmZeqZD/LWLBrBjg0jkmoxvLdGXNyFRyAdG+dI80arqKg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5054.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(376002)(136003)(396003)(39860400002)(366004)(8936002)(7696005)(52536014)(76116006)(66946007)(86362001)(122000001)(450100002)(186003)(54906003)(55016002)(26005)(2906002)(38070700005)(38100700002)(71200400001)(9686003)(33656002)(66446008)(5660300002)(64756008)(66476007)(110136005)(478600001)(66556008)(83380400001)(53546011)(4326008)(8676002)(6506007)(316002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?hLGdIOJGG6CS1E6CL3AiBfBhKnoL93KBUeEJ1LpozD6DDQWDLxkaq/E41CyW?= =?us-ascii?Q?CSNA+TO2CZmBJDgwrugfhztp3rccNhaK50IRYDQ0L2QGFoj9sXCbxGV2Kfti?= =?us-ascii?Q?n18sZ6WLDPjcqf6vSIJRFDw1p1qntUyCKYYdn6JBnE5J7ZEvzmS16L2u6FgJ?= =?us-ascii?Q?KT54/CG2CW6/5XeoVtxqcgfeBsG1P4OqACvaNW2f7DBoV2bEj6JN7cgBNbH/?= =?us-ascii?Q?P8J1V874z//qyYxY0yuMl9kQQgtJZTo9NVaca+CLOVaoxReW8ijeUlaC5nj8?= =?us-ascii?Q?xi3tEAsKh/xmWS/r8uqLgKv0b1qGMbt25GVVnzsq63gve84avo1hJKVTFt2w?=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akNMjysonT6TPMv2tyixZBcHVtZg?= =?us-ascii?Q?Kk5ZIk7olgg88KYnRRN/oskdnP1Jcx1f5aX8tfQcBphhkl+FmmiHhfweeQHn?= =?us-ascii?Q?IO0RRxTpMA2XGLluSxj3JL8c?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5054.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67d5ee26-7a40-4fe4-7499-08d970499f30 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Sep 2021 08:46:15.4804 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: wMvVGf7O9cvKIdssIluJM041YutSKisf5b9g7q/HTOUA8MsXSrFyLP5eTzPocjMW1TQR3akEf7P2OglinP9rbg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR12MB5479 Subject: Re: [dpdk-dev] [PATCH 1/6] net/mlx5: fix shared device context creation error flow 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 Sender: "dev" Hi, > -----Original Message----- > From: Michael Baum > Sent: Tuesday, August 31, 2021 11:37 PM > To: dev@dpdk.org > Cc: Matan Azrad ; Raslan Darawsheh > ; Slava Ovsiienko ; > stable@dpdk.org > Subject: [PATCH 1/6] net/mlx5: fix shared device context creation error f= low How about something like this: fix memory leak in the shared device context creation >=20 > In shared device context creation, there are two validations after MR > btree memory allocation. >=20 > When one of them fails, the MR btree memory was not freed what caused a > memory leak. >=20 > Free it. How about changing it to something like this: In shared device context creation, there is a missing validation when one o= f the btree memory allocation fails that will cause a memory leak. This adds a proper check to clean resources in case of failure. >=20 > Fixes: 632f0f19056f ("net/mlx5: manage shared counters in three-level > table") > Cc: stable@dpdk.org >=20 > Signed-off-by: Michael Baum > --- > drivers/net/mlx5/mlx5.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c > index f84e061fe7..f0ec2d1279 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -1254,6 +1254,8 @@ mlx5_alloc_shared_dev_ctx(const struct > mlx5_dev_spawn_data *spawn, > MLX5_ASSERT(sh); > if (sh->cnt_id_tbl) > mlx5_l3t_destroy(sh->cnt_id_tbl); > + if (sh->share_cache.cache.table) > + mlx5_mr_btree_free(&sh->share_cache.cache); > if (sh->tis) > claim_zero(mlx5_devx_cmd_destroy(sh->tis)); > if (sh->td) > -- > 2.25.1