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 ABF2DA0C43; Sun, 12 Sep 2021 12:36:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 313F8410DC; Sun, 12 Sep 2021 12:36:54 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2045.outbound.protection.outlook.com [40.107.94.45]) by mails.dpdk.org (Postfix) with ESMTP id 33DEA40DF8; Sun, 12 Sep 2021 12:36:53 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nfjOZH/8D2QZqw0y5vxApLu2zzbY+V8j85HOdbGp1/Hf8u5pQjpdiNaloQQC26iBwziyIS4aVZWYQgbkpg40fCsq2KwxDkOWzHTmKZ+pvvOFrTCXEfKjGhN/ZWSSycnqjsa4SxWtOl4kudmlB034IFciPj8YLKUcsZamkrlybOFDCRhgX5KE32b4EDByVPuRQwX1rUnnZc3UBsdOL4gXAtQBDrWUATvkka4Z1kUpuWjLjjg1MgS9Pfz+atyqFhv9lXATglPkzTQ21cNa6sQe2aYAsXa/Z02hb1zWD7MKrmD/lfHLaAVHzw8lAN7QlQqbwI2ikFVcwEGeTTjtgxpbEw== 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=jI4r4R5iHgjEC+uGP0XkOZdL5aij2AzNSajvHp13G+A=; b=IafwTEnLYiI/rn34Z6ktkyNhs6jB+pBUyb+zIeiZhXQCnz3bracrhpZX0OOcJNgM3rUrFfLJR/EbEFIIDE0NAAtN4DsMpDjnkPz6fTO5licTE4KDm7JjKo4OkFC/AOFom9meEmqsoARb3bbDBqYZ6tKZv1uj18nDgLWsZIyLI/uxLFMKYngqO0wIBy1R+2lXyuENlo/fcpIIhzcOiy9D/5RWCXUBDvukJcRWcmkRP9BU+cVVkAWeXsT8EfS5TvhK1BbzrBACKulgbyI4S2aD+XrHoiuwxQ4CQ1/iYzEDa9lhAW/lhvGxlPnF22JDICa1eO/0OGblvAAyDFf/Sj2/og== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.35) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=jI4r4R5iHgjEC+uGP0XkOZdL5aij2AzNSajvHp13G+A=; b=ZqtQClI0BRieBDkGdlskolVyO/HsssOMvhy4SxYOO/aPvQwZiJv3PXazHBRNkDK345CKlcTm3wt+Vq0HEaX12bkxV2v1tlltuw0+PqRkAgNMt2xbQ9ftgTCE4pQcY7wfMcnrbTtGB29IdOkecTS65Cz2hWP2zD1X7me24uxQWdxNlhKH1XLDR8hEp6tWqKC13tfnnlOpNwomCJdyO+s5jj0aYWq6xFFN5ZeQ0jdx0Ht/Ni1Zv3UlkX1TepDCH8YtvkRc8Qpx7UUOm4eb3OAM0y9JCFYc0ocJyJT1B+I1G1qGcczv23WZXdz21O1cJ4nAkFz68AsttRDbJMzwqR7WkA== Received: from BN6PR21CA0014.namprd21.prod.outlook.com (2603:10b6:404:8e::24) by CY4PR12MB1496.namprd12.prod.outlook.com (2603:10b6:910:10::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17; Sun, 12 Sep 2021 10:36:50 +0000 Received: from BN8NAM11FT062.eop-nam11.prod.protection.outlook.com (2603:10b6:404:8e:cafe::43) by BN6PR21CA0014.outlook.office365.com (2603:10b6:404:8e::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.1 via Frontend Transport; Sun, 12 Sep 2021 10:36:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.35) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.35 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.35; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.35) by BN8NAM11FT062.mail.protection.outlook.com (10.13.177.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4500.14 via Frontend Transport; Sun, 12 Sep 2021 10:36:50 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 12 Sep 2021 10:36:50 +0000 Received: from nvidia.com (172.20.187.5) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 12 Sep 2021 10:36:48 +0000 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko , Date: Sun, 12 Sep 2021 13:36:23 +0300 Message-ID: <20210912103628.257499-2-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210912103628.257499-1-michaelba@nvidia.com> References: <20210831203732.3411134-1-michaelba@nvidia.com> <20210912103628.257499-1-michaelba@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 971c1599-c990-4158-4812-08d975d93ae1 X-MS-TrafficTypeDiagnostic: CY4PR12MB1496: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2276; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W2y0QbWaT/Ov0+3byKjxKt/ZXJSqaO1K/H6gzIYvtaS9jrk3nlMvIZSi8r+7IUdcDf0cxquwLweCS3oJUAS+KgaCM9teZtrDqcjrzIny0k/k762aiIVthRwGF9K/4Lv/51AWBnRz29CSuvfDyR8hTrsptqaX3bgLmQwLNd8DIqEYUkDezm+g52GgE2rzzVM8DlD2Xk7u/6PqIHYK9VwY/xlEJdYWJdYy1eTFm+SYJpYY57CUASLKby7tL4wlXF70eOZfCz15ZeE7TNJEr9WIl6iCS9AyKnmQq1JA8Tg87qJAkRCN3I2H17u7Q5wHMydnu7jG1rIBgkNT1qDciKtdP2A8ZwJsmG7g72dAsmBNMljG8puGylh/JO7AJdVVKRpLeog12Vuic8deTEaCUShOQ7f2iqcYSB3Sxcn8bdb6APEesuE9sEj3iiGcrD3giAyFFdI+nysmUrytSDpg0hh6nzK6u1nlCGGHGZpChqQbFV3PKPILLIWieQ54K89j4UJNpSn9s+cmfAGGrNO2h7u8sUP6AOHkkiByzFE/ORoSE40o+XVXshKzMrifto/U6VHBmCFePTQT3pzEobpKrHaLdWlY3npF4OMVsN0bkA53Qbm66qojOejb3qcl8Z3IhCDkAaDt0ImPRX9uL0rZKqxpK8/PU8a50xEbj/SpKoM3F1kAsVFhjgchtgAJFIwFODXLNlxhvmDYXTGtT8cHoB1NSA== X-Forefront-Antispam-Report: CIP:216.228.112.35; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid04.nvidia.com; CAT:NONE; SFS:(4636009)(39860400002)(376002)(396003)(346002)(136003)(46966006)(36840700001)(8936002)(86362001)(6916009)(36756003)(426003)(450100002)(54906003)(8676002)(36860700001)(6666004)(83380400001)(6286002)(7696005)(1076003)(478600001)(26005)(4744005)(336012)(47076005)(16526019)(2906002)(356005)(5660300002)(70206006)(70586007)(82740400003)(7636003)(186003)(2616005)(4326008)(55016002)(36906005)(82310400003)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2021 10:36:50.4032 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 971c1599-c990-4158-4812-08d975d93ae1 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.35]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT062.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1496 Subject: [dpdk-dev] [PATCH v2 1/6] net/mlx5: fix memory leak in the SH creation 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" In shared device context creation, there is a missing validation when one of the btree memory allocation fails that will cause a memory leak. This adds a proper check to clean resources in case of failure. Fixes: 632f0f19056f ("net/mlx5: manage shared counters in three-level table") Cc: stable@dpdk.org Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5.c | 2 ++ 1 file changed, 2 insertions(+) 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