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 C9E77A034C; Wed, 23 Feb 2022 11:25:17 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9B7DE40E5A; Wed, 23 Feb 2022 11:25:17 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2083.outbound.protection.outlook.com [40.107.243.83]) by mails.dpdk.org (Postfix) with ESMTP id 0206140140; Wed, 23 Feb 2022 10:32:53 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fpHBom1aoKE8yW38GCVhvC3NMjjAlBNizQkV/Pcc7Pq84EdeagHwrt/mEw79LJvc1eEVBevcHWdQcOdphglti+v08y64G0Iy9AEbWaZBNO+HAmarV9neZD6POkySmqGt8k9BZZNIAUNE8UZsfHSJmupsihRSWlFMm91kJHFv++llLpLWS43AR4GXntSyZbuForZQArTBxY/pwGELCP0Fj69WB4y5fJIbJkb29O/0UkZsYRbHGdzQcO+NR7nFHwpICFkeE7uVxmnDoq76r1DhFCbcaI7/71voAis1jmfn35fTqCkREZ3Rkf0AMVmCSRXM6La+iogZBDCPqeFKhvYDUg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6RguguK57kb/BU6VuHeLLoxUT5Rcw+ACQjXcibz95pM=; b=cm4TrLCaYljtLuF1UCPmxi/6m5LMPXaUYLhCwaqFTFb9C1MG5oiTPYHCT5u2Rk8/UJMfWbqm2rVZtDcyZV+JGi74SeWIG1IspNy0NuH4YU026YPJ+ruMSPl1qgbxkhcTiVWcRMluCdRqU3lvnFrg/FChxO5+ctQvU06uQbSKd1T3ZPAYUeHov//KblV2NP/4xmy8aG3KFAXOH2zril6M+Xit3xZsKdMgghWwfDARqpLW75tlD7kUh8LFdu28HMrZtvnbWWKoskyqKo1874vqMKoybvl11YeV467TrL2kLfPFO+5w0dGt7Lla9J3WttY+P8Mk0ddRUXtWTsEDDk5WFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=microsoft.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject 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=6RguguK57kb/BU6VuHeLLoxUT5Rcw+ACQjXcibz95pM=; b=rJunXpJ1i/jKecefLtPm+IEZIy02szHo+17y0aiCUQWZQDS/hurpFzUvwl3VhJQJn2R4REXwMSEHa4g5bIZAzxaQpu3nLZT0RV+YQU4lMS0yrGePwX9aAKoYQbafHwbAJ27SzAykR2lizUBmqviNgdIAyzYLfAxEBtNW2NdfawZLIWSS6JeR1KkiFhDDWB1EvBc9wjSxzKFoSA+vWOE4gyDd3hKrELyBJ3CmsOySe4u1rA7ulfJHM6KCgrVKQoFD0EluhRPVhOCst4GplPPzQCKmTwHbPjRnSIwkd/coeH80jN3BNXofQ1cuqUSBv1Bwok0ZSnZkxUEqc4Gq4xT6rA== Received: from DM6PR02CA0145.namprd02.prod.outlook.com (2603:10b6:5:332::12) by CH2PR12MB4198.namprd12.prod.outlook.com (2603:10b6:610:7e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.24; Wed, 23 Feb 2022 09:32:51 +0000 Received: from DM6NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:5:332:cafe::60) by DM6PR02CA0145.outlook.office365.com (2603:10b6:5:332::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22 via Frontend Transport; Wed, 23 Feb 2022 09:32:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by DM6NAM11FT015.mail.protection.outlook.com (10.13.172.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5017.22 via Frontend Transport; Wed, 23 Feb 2022 09:32:50 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 23 Feb 2022 09:32:50 +0000 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Wed, 23 Feb 2022 01:32:47 -0800 From: Adham Masarwah To: CC: , , , , , , Subject: [PATCH] net/mlx5: fix destroying empty matchers list Date: Wed, 23 Feb 2022 11:32:05 +0200 Message-ID: <20220223093205.4240-2-adham@nvidia.com> X-Mailer: git-send-email 2.16.1.windows.4 In-Reply-To: <20220223093205.4240-1-adham@nvidia.com> References: <20220223093205.4240-1-adham@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c2e6968d-748b-4384-9d3a-08d9f6af7609 X-MS-TrafficTypeDiagnostic: CH2PR12MB4198:EE_ X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MN6SapEUx60P3w0ac9XQA/xLuLgbLLxO4J5iFIc0gJLRPfRa64rgyH2a/yK5P9/4TnVUs7WBxQEmEbrngq3KYVDzh+w4T+wmnccWsxvffizQUTBv4Jp3bLTNCv5WbXSB2MUNu92s4rnJiMLw7E1oQGQ8auA5DV14HNefazR7Rm4PSI6Iuws3ir8pzLYMuEAW12jZGDiIygFgczp8mxjT6pdQxgcIPTn/UnyvL7N6NxygwWmsQ/cifMewUH7KUtaWMac0WS4gz0s09nuJ20USx3+OTgmkmfOSdCqgy/1q2q+260h6venAOUYz5v/AkxvNnLrtL4Dq7KDObLHuomdP6N8N/Okws1tTIAEevck6GqQYpnsACC30WHVZPluZGbBcJS+G7W/czgJqU0tmLqlv8GsccHNoM4YMXeinWpBLrSUBALzxTCC4v30H8mXuQsOr336jtqf4+yoG+qHeRb7ALx8gux6QncS/B0V9BhFJAUxwyDnVsuhpUb1z8ggHUMhLdHKLnzgGiedN7d244v28Jq6ZjFCzC5aStIH9sUxa6eilDV8xxJU4ublbXirenagjfu1pHsIyupi3RXTsM9IfezQLr/gdgiJWLK+rs5ThWplxlmVZznysjQML8X9gTlW1cQVA+SFFwspx9HF4cCO41GMoryeuO2wk+b3ZJLHq+mQ1cLz7wGrxjEK3f+HKGZxspyn+z0DXIIeIOrJ9qSFteA== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(36756003)(2616005)(6666004)(7696005)(40460700003)(55016003)(47076005)(508600001)(2906002)(36860700001)(4326008)(186003)(1076003)(6286002)(16526019)(5660300002)(54906003)(6916009)(8676002)(8936002)(26005)(316002)(356005)(82310400004)(86362001)(426003)(81166007)(70206006)(70586007)(336012)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2022 09:32:50.8437 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c2e6968d-748b-4384-9d3a-08d9f6af7609 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4198 X-Mailman-Approved-At: Wed, 23 Feb 2022 11:25:17 +0100 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 The table remove callback function is trying to destroy the matchers list associated with table entries without checking if the list is valid, which causes nullptr dereference. Fixed by validating the matchers list before destroying it. Issue can be reproduced with testpmd on Windows, when you run: port close all Fixes: 1872635570be ("net/mlx5: make matcher list thread safe") Cc: stable@dpdk.org Signed-off-by: Adham Masarwah Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_dv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index ef9c66eddf..baef252a7a 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -10503,7 +10503,8 @@ flow_dv_tbl_remove_cb(void *tool_ctx, struct mlx5_list_entry *entry) tbl_data->tunnel->tunnel_id : 0, tbl_data->group_id); } - mlx5_list_destroy(tbl_data->matchers); + if (tbl_data->matchers) + mlx5_list_destroy(tbl_data->matchers); mlx5_ipool_free(sh->ipool[MLX5_IPOOL_JUMP], tbl_data->idx); } -- 2.16.1.windows.4