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 9453FA034C; Wed, 9 Nov 2022 13:58:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2261340151; Wed, 9 Nov 2022 13:58:50 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id 79D80400D4; Wed, 9 Nov 2022 13:58:48 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xtq1B3oM1RmFuyDJfEzBNiNoQ64J9bjZMS3qlpOTw5+luq0PgNGzUlHjvyA/2InLTe6CWCwRQI9HE1soIafC4m9HhtUY7Vh/74llmHLb1GWNtEnCcFEvmtk1ygGEq6TMmJBHOH582K2J4C4NX1T+M6wQl0D9z5e5sGy55kSo0YzvtRkIlZ+cQMJVOS0R7UKFN6VvZA1kY05TmD52QargvszQvV3ai4osEqNBR7S1VBmGOfYPOnEPYTSS0XCCHIvvUV/lW8kOECvbYtJ+OvZtFO6Ru8EeSKz9y1C33KEP2PFayaXet1DywyFBaLHXzeUJ0RIpBOvobro6PGZxCd4Zzg== 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=7TxpJf37UgwKidOVmv5fZ5v26NG8dBXqOB+wjfzMegE=; b=dGwrolSDLYk2PKX75H91hlhgEDve2CIkK5+eypFR7XGufdO6/UdKNEJBiIJ0oouP0ymYBCFVMJKL+ApqgImc2WhsRTi4lrTd31Lu+FSu4nd8LRJANoGaEUNpnf2ggQbImYQkK9X6izs9nwQbJXUNc8fJhA0ni2JgPH7ObMPtGAnBLbxW+BJzxq/vA/I7TeN8iY7orpFW8v8GxSBrpzlh4KLSiJAw4sHW1I8nQDukCnmtxUVPo0PTIIUHOQveaDmJ0KpUfHO8pNbxNf1tAFeQI56nt1u8dlX5ela1Hj3fZJOxOSRQhldiaDUo03TwA4bDWItKCAnGZbzmtQKtF+QZzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org 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=7TxpJf37UgwKidOVmv5fZ5v26NG8dBXqOB+wjfzMegE=; b=Qg3Xk/gzsd6k8C/EBjTH0G5XKANv4UP/GD7cadvmc/icTEcJlG9Rttd6g2iIHRwR8VFDeGi1TswxKlABH5I4SA99QyIF4jrJyZP4b1KbFlbvAES7hK0zrAWpdfr7cWFbvefevws7qHQPi8nLQqAHMFt43Hec39c3ktMc7tJIgoSPcAfzShJ6e4DZhkTi2/w0YY9Pk9wuhW41+HZP6bvO/JUx4HMh17n66+2IT20fR4ra7sCmqh6JQJIl3vTOouIUMwjFb0KAoZ5J6jbDoGMets8OwVZ/kEcx29SH4WyNusclYiBN/uGoSzMAovesbpsq01+s7Q/MBYwi/0dvK1lDJA== Received: from DS7PR03CA0142.namprd03.prod.outlook.com (2603:10b6:5:3b4::27) by PH7PR12MB7456.namprd12.prod.outlook.com (2603:10b6:510:20f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.26; Wed, 9 Nov 2022 12:58:46 +0000 Received: from DM6NAM11FT079.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b4:cafe::cd) by DS7PR03CA0142.outlook.office365.com (2603:10b6:5:3b4::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27 via Frontend Transport; Wed, 9 Nov 2022 12:58:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT079.mail.protection.outlook.com (10.13.173.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.12 via Frontend Transport; Wed, 9 Nov 2022 12:58:45 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Wed, 9 Nov 2022 04:58:37 -0800 Received: from pegasus01.mtr.labs.mlnx (10.126.231.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.36; Wed, 9 Nov 2022 04:58:35 -0800 From: Alexander Kozyrev To: CC: , , , , Subject: [PATCH] net/mlx5: fix indexed pool local cache crash Date: Wed, 9 Nov 2022 14:58:19 +0200 Message-ID: <20221109125819.2923383-1-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT079:EE_|PH7PR12MB7456:EE_ X-MS-Office365-Filtering-Correlation-Id: bcedfcbb-95c3-4b28-97bd-08dac252231b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: N5I+rOCZhTVqy4WCg78aIpX8aQ3zC/Hif9HXar8qgvdFaHFGaX1Omx4RgyBGd3PudotF5MqFTEbGA0176R4g9L+KojfegHQ5o0lXcakB6K8z/zDEzhPAvWMqxaJo8hz4KAWMZAniZmdvyKxf07Rk3OIa2o/yj3J4TG8AhHkj32i5ghHvwWHoI3X9c2itonwAFPgEcrFLRHDyym0NOgXZBXrgSmUbirbGRGZMHh55qY955fv3Vt3MaGdVwFfShMQ3vzMiaSLSXsjKaE1gbp9OCPjIvxPgAibRJjxlNFHYx+5dosw4NKbzdNWzKSJQQ6mCb7+j+JlxJCOWiN+jl7Zz8CrVIoW48XLNcor6t1Rh21Niq+vRPzpur1UZVkgVbwlyOpV1rNpIXjLsxftbz5idn1qAf2awcyUP6ILm0GsKM4IAIqcj8XEaSS9F6XP7U7JLSp/WSAnK8SMoiZ29GMKIL0p9GVbX1XzkXOlOAAFI3NnPGKpp/vmN1G4JFLoCqBAMRkon9YJaWutBv/reMPTaLV3DYvLVgQQv3vPDCwNqZuH2L6FGY29xsOYfGwY0ylGMaFNI+imkWFNkc2G+RU6IBrsW4jCukK0OAIUteGOBwOp1NJUc4mwGtxKF7rQk+NWIdOaMjFIiJe7tLmbMyChVjNauYEcoFcFh7WUCzATK/7XWpuiz4l6t39LGf7N1fo/TT1v2AXyv0eUGNAdRkEfAk6D7yyv5Jb4ISZ7oLcUG517tRdosTbSzkLOgO3p/KvtbsrGWUAMYzwGlXqlOYyja9w== X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(376002)(396003)(346002)(136003)(451199015)(46966006)(40470700004)(36840700001)(70206006)(316002)(82310400005)(36756003)(26005)(450100002)(6916009)(7636003)(356005)(5660300002)(83380400001)(4326008)(40480700001)(8936002)(478600001)(4744005)(8676002)(41300700001)(2906002)(70586007)(336012)(2616005)(186003)(40460700003)(47076005)(16526019)(1076003)(82740400003)(426003)(36860700001)(54906003)(6666004)(86362001)(107886003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2022 12:58:45.6901 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bcedfcbb-95c3-4b28-97bd-08dac252231b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT079.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7456 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 Local cache for an indexed pool is not initialized in the situation when all the indices are allocated on one CPU core and freed on another one. That leads to a crash once we try to check its reference counter. Check that the local cache is initialized before accessing this counter. Fixes: d15c0946be ("net/mlx5: add indexed pool local cache") Cc: stable@dpdk.org Signed-off-by: Alexander Kozyrev --- drivers/net/mlx5/mlx5_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_utils.c b/drivers/net/mlx5/mlx5_utils.c index 4115a2ad77..b295702fd4 100644 --- a/drivers/net/mlx5/mlx5_utils.c +++ b/drivers/net/mlx5/mlx5_utils.c @@ -479,7 +479,7 @@ _mlx5_ipool_free_cache(struct mlx5_indexed_pool *pool, int cidx, uint32_t idx) mlx5_ipool_lock(pool); gc = pool->gc; if (ilc->lc != gc) { - if (!(--ilc->lc->ref_cnt)) + if (ilc->lc && !(--ilc->lc->ref_cnt)) olc = ilc->lc; gc->ref_cnt++; ilc->lc = gc; -- 2.18.2