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 B0837A0C54; Fri, 27 Aug 2021 03:23:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 601D441250; Fri, 27 Aug 2021 03:22:52 +0200 (CEST) Received: from JPN01-TY1-obe.outbound.protection.outlook.com (mail-eopbgr1400092.outbound.protection.outlook.com [40.107.140.92]) by mails.dpdk.org (Postfix) with ESMTP id 3050940140 for ; Thu, 26 Aug 2021 20:57:13 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OkXynBoFuLSkpkmvhypeBtUx1NOtFN1DebpBDQQNipX2fVAnqK4Yu8BHFD/jjXPCa04FAQ9uTss+J3tpzHJqfCdFvDyrO1cZzLtH+N7NvPIdCSVRbN32xlLSA+8cB4tduF2qh5WnBk863dn2o8LA7D/AL83frbE964HMLHyRhtZPNgyZ6WoeUYzZPmSdRM1xP724btvCLjE1CBhaH6BvXvmNxAirVK8CZoFytIqq01qKaDmPGo7jc6B7VZ+23dx9Y8OYhx5xVKRlzns8BP0aaVytSKjqGevuGrt0XMlPbD+efxwmygq/9v1KOoL337fI1tZ5j0Hv3S0rBrr7/a3aDA== 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=mYwGU5pt9Jz391iCU8s5RnTQTJYzX9Wy0P5Ol2joh9EF5+eLemcG5gI5i5eS2UBYkM8Va7/MsIkdHdJiI0z9Mq9GdC7AF5Gvux16b1lzHP/LFaW4ymWK8hCR+cyKcb55JaicfAwUCwhHOdpCEBZCSFw0wgcFmI8XmIr63gduXahMBIiTDWzozkcMS2Gmfx3AB7Q7lpy5PQpsCGXa/TxvfZkhuFL69FwRh9YCY5NboxVbNL1ZVc8gK6zM6YtKqaCDbOVXtVKLmDVU9N8tcIDMu/orZIQPLIcKf4kG7WDdU9HNUkSxs+QES2rXT5SfDNsLRaFK/wMAXBqr8/7PIz9djg== 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=6jK40MPSLIm65k2oNC6C0Kg1FKrcQT7zfn3SxG98vVhRcN6P5WeotOp8xlMI+onefFiJ8Oxep3zcdy4J3YIQS9OVWOUnnKhVAOjFcg/9FXZYgcu4edG/y9c2dstqcV+cPp1Ik3kEqZWKVYPLT9z83RvaZXcGXfSKthZ8vu9ITNs= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.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:57:11 +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:57:11 +0000 From: Chengfeng Ye To: asomalap@amd.com Cc: dev@dpdk.org, Chengfeng Ye Date: Thu, 26 Aug 2021 11:56:33 -0700 Message-Id: <20210826185633.107314-1-cyeaa@connect.ust.hk> X-Mailer: git-send-email 2.17.1 Content-Type: text/plain X-ClientProxiedBy: HK2PR04CA0069.apcprd04.prod.outlook.com (2603:1096:202:15::13) 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 HK2PR04CA0069.apcprd04.prod.outlook.com (2603:1096:202:15::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17 via Frontend Transport; Thu, 26 Aug 2021 18:57:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 67cb01d0-ccd2-4967-b045-08d968c34fb6 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: FUMksTuYbOAVKWuNbFt+Ik5lslz1MGT987TAhcoGgi0zEMSYCWmVsTcnxAJpuIYbj/wobs5MK2tX4+FzmzLuES+XBW0nbuuWhyRfsJw2kwUBbFSmnKyOPTVahIcqG5cKSuohjkDbibdCWohujbt7arANky/PQ76TQSxLVTVJ2OOSo748E3USE8gfP+JOIJDKqz9J0qkOIHGJaK9yPvNaMGQ1t2MpOxmExpG8Mu9qJ8edachsHoXFPL+M3EspE5fOklmyjzkZXWDZ6lFt9dpy2ldHByn/3c+KirPnRN00dL62keTnonntJ6tqBTIZKZC0Awy4dW7kvLsHY1Gfw5xNZ1ababK5LQ3mu5SwSj/E7ZS3TSLdAjR4BhCtYbEeLyZwwW/qtZc1UeGiuJyxsqYs0pB4nkXAvhvNrWzYAz0D7r7FXWlOqr8qucBpgPYLnm6Ac5Ya1yGs/0Ii/ELVyqink6uRfeIIl7YK4rLlj8cp+iAg56wj7yeqm5Yko1RIBtCXQggWi9VvflTv5u6WJDcOQLC/e0Txa4tDuC/GbxKwxNwrEIgyHI80KSNhQubFC5kEeTRkQtm/xP+X8Jn7qdmsMhGw2+Fzrmea317S5bMKQSsn2OPpXYjL+KhxV0fShLkoNaBnEn0FAiWGNcZauXIbikGh4QcvRisZf32b85HB2VgXr12l03khXjcAKyCJPzoSwdSQQPjMsnYtlM2k84Qsvg== 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)(6916009)(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?jq5NqKG8uyFazhYVCjbjZ49oktNRCg1O0O4XeVEjiQ02xP2jQQDZU8ENHK0f?= =?us-ascii?Q?L6LVypFoHKVy0x7bZFggr8m7aIV5VKqZB6rMkzUUHh2MDGi6MHTukeTR67pC?= =?us-ascii?Q?yMIgfX3XFw0eoIhj+1YJ8F+wJogESjPXK/0yYathFEHC66UmyKxlajYSLBnw?= =?us-ascii?Q?1cQmv6uTIcCZH3Rb+2JrV8LCY4xecHItAoZg7Km5Lv4BLk8WtBO7fKefX/DN?= =?us-ascii?Q?xJBxo44bU6dC7Yu/ToXjcbkDMwn32tYnzPmkH1ywhIyjH+RaxHOl+0NXAjDq?= =?us-ascii?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piyHwSiKWz8QX?= =?us-ascii?Q?TCmK5znYqFcnbmMKvUHFJWdLsrX9WLodURsyowPwQTtyEJphpmcCMKmo20gB?= =?us-ascii?Q?bVyImaoooOTKa1SHukK+89bdxYshwrIqBu4ItAZ3cpR/afLF5CbCKmLDwd3z?= =?us-ascii?Q?pkfFyT+efrVZPptwM8kF6aHE?= X-OriginatorOrg: connect.ust.hk X-MS-Exchange-CrossTenant-Network-Message-Id: 67cb01d0-ccd2-4967-b045-08d968c34fb6 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:57:11.7030 (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: ccfo1vNSEulsUrpfvty20dWAtcZn/3ABwtR/xB/HYdfohzigdbcPKgTcACjuBHk5QkjPgviLxdANTsfCbUtF3Q== 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