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 DEE22A0C54; Fri, 27 Aug 2021 03:22:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5E2A84067C; Fri, 27 Aug 2021 03:22:50 +0200 (CEST) Received: from JPN01-TY1-obe.outbound.protection.outlook.com (mail-eopbgr1400104.outbound.protection.outlook.com [40.107.140.104]) by mails.dpdk.org (Postfix) with ESMTP id 4559E40140 for ; Thu, 26 Aug 2021 20:55:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fOEiOg24qeL2viRS8S43M1CjoP4wqDXl7+RhT7b9x0Is5NHSDrKa3Ts1mVmvf/9mSTl2fVpDMocRjDeuhY2cuA4KM6EXlf+RfppOsLNV++kZ4gXQ2bpPPag48lVOTr237/lSnfr1yOYbTqbWBzSnDKoCm+FafLjZWGStR3jkeUtMaFuYSxZ6Ayden9buD91r8Y+a1izIfdkM9zN/SMjpah3eHD9qBEazkOEQyU7PQ+1vTHkJAyiCPjrVpciOVZU8y5yEZRu8M7fWpYUjGuPXNX+uEf6T0PoeijkeW5KgKi6+itSEZPg4G8kF7sldWfOBVFJlejUK5CCmZcdeGDfjZw== 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-SenderADCheck; bh=A+oCJhxJ+mBs0vgD1qdUQO0Qmmp6IKq+YhgcrRLHfIU=; b=dZXgnlH6s/saFaXQCy2HmRWWML9Aiji9jSZ2Y01cwyikDc4MrcTKdOF55icXowoUnJa+k45EG7TwV3QGTvCChQMZhxEVBt76o/ebdB46hSAYDFb/y9pizBeHo8oiKEL9ddvLSmQxE1Hxxk5/khL7VqJkGGN8DTtjTtK7PHYvk6GDdV9tcUvi/SqppK5PKaeEhj7mUHlsaPrQKX45tXtrXZRZuS52yuKA41ZYZWzFKHf0umL66d6crXtd54BtOPE81M+fB0ISDDfZaeW68iDrLGxU0AQ20wQuTQLIo2ZhkgECzCq4FF/A/yX7A+I1sA+gJh8E76fjww5pAhNvJLQyDQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=connect.ust.hk; dmarc=pass action=none header.from=connect.ust.hk; dkim=pass header.d=connect.ust.hk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=connect.ust.hk; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A+oCJhxJ+mBs0vgD1qdUQO0Qmmp6IKq+YhgcrRLHfIU=; b=hoN/WubpvBNJtnOKtxSZqKR6tBsSqT4kIlKHoLrXMZykP2g33kUfJhOQDhmsD8JM3VNDqagen08upxx0L1kEsNoRdyNrZUB7YFCxFSHLkCcV+3aXh4Q9U8FcEjJs3zS+9aNai3xosJx6tZrdOmFcmtfNg5W/yPceqZ4bUgHkMUI= Authentication-Results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=connect.ust.hk; Received: from TYCP286MB1188.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:b7::8) by TYCP286MB1092.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:b3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.19; Thu, 26 Aug 2021 18:55:33 +0000 Received: from TYCP286MB1188.JPNP286.PROD.OUTLOOK.COM ([fe80::b9cf:11ff:5f5a:32c1]) by TYCP286MB1188.JPNP286.PROD.OUTLOOK.COM ([fe80::b9cf:11ff:5f5a:32c1%6]) with mapi id 15.20.4436.027; Thu, 26 Aug 2021 18:55:33 +0000 From: Chengfeng Ye To: matan@nvidia.com, viacheslavo@nvidia.com, tzahio@nvidia.com Cc: dev@dpdk.org, Chengfeng Ye Date: Thu, 26 Aug 2021 11:55:07 -0700 Message-Id: <20210826185507.107151-1-cyeaa@connect.ust.hk> X-Mailer: git-send-email 2.17.1 Content-Type: text/plain X-ClientProxiedBy: HKAPR03CA0030.apcprd03.prod.outlook.com (2603:1096:203:c9::17) To TYCP286MB1188.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:b7::8) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ubuntu.localdomain (218.253.253.162) by HKAPR03CA0030.apcprd03.prod.outlook.com (2603:1096:203:c9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.8 via Frontend Transport; Thu, 26 Aug 2021 18:55:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 00d9d7cb-c8ba-4a43-4468-08d968c314bc X-MS-TrafficTypeDiagnostic: TYCP286MB1092: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1850; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vcorlHOb9NG/xazlXISUIBfJXCubKI88glASptogH3ytd07Ser3m3iwcMG+PCqxsBIlj16qwMD9xuMn+FCu27RT9eydmo1V3GhXk1RPBIpRX3lLjK5jM3tyc4KBhhzrVb9+/C7YKfdnI41dQwJHPa/S2WUtxyAUxynyQ/OqE2JEExpaM3wZds3HL1xutOIXAOQrwE9ghy9N3PkfdyNwEjd3AwnYMahuBz9hbi44LxvS9NrIYLb8rZU6yx3BIJWkmkgrz9ncHdLps2ciazZONZsuHMX1DMG5xKbOkDuIQ5jBGZHBjTmU4uyeIlZ1MfsWgQc7E4WeGuADDoeM4hYF5dg2G7pzdyNTqE2Jupc07Iv3N/h13/posFf1PvmQLQP9VgylMclPypY3pmcr/mNZm8gI4vaWcIkEDDRcYgMS8PCYFN2yWbTObnTNBa0YKSnjFQLVJe4EouDT0qWNqlgwvE0DR4A5zU8wVIwHLwgrAkuwgEpCRQ4+lQrsVuGHXKECDBT0v0H362gchqW33PmzeA3C3ao5RjuJ8nq6fCDPRroYsEoMBhYw+yYwhcibOJvryzZEQD4hFqNAPPxa6uHKSCmIPiYRGsixJNFW+dFkVlVkya+s7lG9g8CNm1PuyAhcktluaWhwSKbvdD2rjFhWVYf3GjvDg5u1wMSC/XwXMomSpjyK1F9kE07xKVa7UAyt7+fpQ8KbP3jxJvmUIKbCoBw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCP286MB1188.JPNP286.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(4636009)(136003)(346002)(366004)(396003)(39850400004)(376002)(4744005)(956004)(6512007)(2616005)(38350700002)(6486002)(66476007)(38100700002)(66556008)(1076003)(786003)(316002)(26005)(186003)(2906002)(66946007)(8676002)(86362001)(8936002)(4326008)(6506007)(52116002)(36756003)(6666004)(478600001)(83380400001)(107886003)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?vqwH2g3sBF2QKeoRAiRhRUGSe1qUrgpeZsDGMlJgfTbzgo8hwfBaUlEdSKcQ?= =?us-ascii?Q?LmWI8vVc+3GyhH1lelRVFlAWyANuGQXEn1g2LbHeDQc1aMozkFUteQF3qqh0?= =?us-ascii?Q?7EFFQvxJ0QGv/VAyqXfrFDE0EbqQiljlmt25P1tWuvQeEBOPZHeOs94cwN27?= =?us-ascii?Q?mUle1lKwRj90/p5qqGwnOUyTKAngunEB3+DYA/DC0+D1312M0kdwMIeT98m0?= =?us-ascii?Q?fVQhNXrjjJbW51KBXmBJpxVk0KzBlvy+jpGWv/hWhRFN7/Id8DYm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8tMetc2xkpqwRRpcl/9fnZjYLD9QNrMJqJK9IBg+9WIo?= =?us-ascii?Q?ydFk2Wu9QPm52cyb0ibp0+jROhiprFhE4Vi2SOX8VOHAb2x/TTl9olF2qX2J?= =?us-ascii?Q?L7kWxiMvPTJymgdSTtBevm3i+T+hlRKpdwVRcu7WRIySOziR4o8ZIWOU5g/O?= =?us-ascii?Q?neIBkFU0MttBs0ROOc3872W6?= X-OriginatorOrg: connect.ust.hk X-MS-Exchange-CrossTenant-Network-Message-Id: 00d9d7cb-c8ba-4a43-4468-08d968c314bc X-MS-Exchange-CrossTenant-AuthSource: TYCP286MB1188.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2021 18:55:32.8635 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 6c1d4152-39d0-44ca-88d9-b8d6ddca0708 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UNYM/hUbM2oQO9ipdNaiEj+AAZlr1YibVbkof1EsRCXGQ/ElWcJulHGEgzZNV6cw4Ue1dvf2qZ21Yau0kCllww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCP286MB1092 X-Mailman-Approved-At: Fri, 27 Aug 2021 03:22:49 +0200 Subject: [dpdk-dev] [PATCH v2] net/mlx5: fix potential unreleased lock problem 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" The lock sh->txpp.mutex isn't correctly released if the function return in these two branches, which may lead to deadlock if the lock is acquired again. Cc: cyeaa@connect.ust.hk Bugzilla ID: 774 Signed-off-by: Chengfeng Ye --- drivers/net/mlx5/mlx5_txpp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_txpp.c b/drivers/net/mlx5/mlx5_txpp.c index 4f6da9f2d1..0ece788a84 100644 --- a/drivers/net/mlx5/mlx5_txpp.c +++ b/drivers/net/mlx5/mlx5_txpp.c @@ -961,8 +961,12 @@ mlx5_txpp_stop(struct rte_eth_dev *dev) MLX5_ASSERT(!ret); RTE_SET_USED(ret); MLX5_ASSERT(sh->txpp.refcnt); - if (!sh->txpp.refcnt || --sh->txpp.refcnt) + if (!sh->txpp.refcnt || --sh->txpp.refcnt) { + ret = pthread_mutex_unlock(&sh->txpp.mutex); + MLX5_ASSERT(!ret); + RTE_SET_USED(ret); return; + } /* No references any more, do actual destroy. */ mlx5_txpp_destroy(sh); ret = pthread_mutex_unlock(&sh->txpp.mutex); -- 2.17.1