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 9344CA0C54; Fri, 3 Sep 2021 10:44:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5755840DDE; Fri, 3 Sep 2021 10:44:02 +0200 (CEST) Received: from JPN01-TY1-obe.outbound.protection.outlook.com (mail-eopbgr1400110.outbound.protection.outlook.com [40.107.140.110]) by mails.dpdk.org (Postfix) with ESMTP id 4C8D3406B4; Fri, 3 Sep 2021 10:44:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iBVRb5yvFJgbFt2g/j3ihlGYbJAoYHcgD+o3Ek3rxNfC6NRPDGFW4jhMtJ9Pc2Oj/9sLbLgxE/2uUWQIo8ZmPCjZM63aykhvzz3tyre36pbvjijMOtFrRhqKRqjOzw8WmyzL2Td2dP+Fz9lcSr3RRYUTtQSHehqPmfQ7PiWStvIY0OvgD2UgE5KT+3siXS4bGIqCPluESZp09jea0FQ5v3PkqxfmUrFQ0+HmzpCEooppO+WSELi80lmitHHi9Hp90enInBDMBEiIVNW/y6XgAAUDQ7xfBvoJgb3noBEBhPaoST1EEOshw+/hEr+1UHxQoqV6QnoR4DlVP0Bf/JxwSA== 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=KLY4OG5wguUv5kT8PurT6wxS1u9ea0KBWx+4mnwqqQA=; b=VyUeyLpH9SkBwN6wrdxHEwosiJdta0mBPq5EnW2r1MQA6tdnuwBjcwMCtMT5+mVRan9TxV5Y1h60sGBxAs+D2/57fXfsY9cCkhex0mBttXOxxFeNojFhpOmo3u40XtM2tpepYDYM6USKgAXdVP4Gtoum1q2xRUCqXD6oxDK1M8UrhorX5oq4cTeIVYIe2DFkfwO7Tw8i+X0fYLG0tW8NMnP+vaT/7wiSoxwt8qXHQZ61glMalJFMl1x3OpO23j2BOSHlTBCoXdIIVnZR6uIUljhPNdnBwQVBYz/CSMjSw72N5PtK2QsK0PKIti/1zTV1cj6Lyq71PBU60TpbHVswWQ== 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=KLY4OG5wguUv5kT8PurT6wxS1u9ea0KBWx+4mnwqqQA=; b=fnTMpq3rtghYwj1DI4ow2NKeMkEOhlVxNdOVnChr5wHI6jPutIhK1JkKAogcb7OuTfe6+vTcqk9NBkv7iAAICstnbXyHq/eg/cVux5fEcNiR8QEe1yXOj7IrZ4+j3bumyWyl2fUsax/w+V6dazclbUjDz7knr2AcDvw5VAUY/eQ= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=connect.ust.hk; Received: from OS3P286MB1191.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:114::12) by OS3P286MB0740.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:e4::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19; Fri, 3 Sep 2021 08:43:59 +0000 Received: from OS3P286MB1191.JPNP286.PROD.OUTLOOK.COM ([fe80::1965:c7be:19de:93cd]) by OS3P286MB1191.JPNP286.PROD.OUTLOOK.COM ([fe80::1965:c7be:19de:93cd%9]) with mapi id 15.20.4478.022; Fri, 3 Sep 2021 08:43:59 +0000 From: Chengfeng Ye To: david.marchand@redhat.com Cc: dev@dpdk.org, Chengfeng Ye , stable@dpdk.org Date: Fri, 3 Sep 2021 01:43:49 -0700 Message-Id: <20210903084349.25168-1-cyeaa@connect.ust.hk> X-Mailer: git-send-email 2.17.1 Content-Type: text/plain X-ClientProxiedBy: HK0PR01CA0068.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::32) To OS3P286MB1191.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:114::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ubuntu.localdomain (175.159.124.155) by HK0PR01CA0068.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19 via Frontend Transport; Fri, 3 Sep 2021 08:43:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b22ff1d0-dfe7-4463-f59b-08d96eb6f8f9 X-MS-TrafficTypeDiagnostic: OS3P286MB0740: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2657; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Sw45GvU7JDz5aC2CR8tF48cQ7dCBvy6uAyUcIO8L6xvuUgqbYrVS7WUzlZK4KpxACvikTGAO1bEODmsDd2GyvA9jJjix/VDqGFTS4R6Ff6TPo9aesEBYX8bSVItwD7DIv2ZhP5sIiL+Gzy/5KMsQjQdEhE2BJqfKTx85FHFzAaXk0shkAoH/NuszrBRTIaIwem9Fygx0I9CPH72v6DzGKZlpOqZaylbwJbqemKjqiRnEs2OH2wz5MclP3SoBOeuuesRB0BLnhr6qyLI/uh/kEdbTLcAm/Fbyzw3Ij9ABAdHJEAO/NSWqbocLvJnSp43JkriUqZo0fAVklhDKiwPqesjDm6ZC9ySmJEkqZbFriuChmbKADk1GSIXeF0g0WszCS7yFcVe2yNWTwQHHc5X+P9sjaWZL8dWicqSqXVXmSmBAXwVDJVQqJUG2QJJw7WctBgGJALpFYFw+LCZNINVvebfJXq+b9Z3fV8Jml0oXiXaAinIfLGHmsPGddlxEtnZAyB+j55BBFJkgRZmNTLS5VZPlCsUnR/8NRQpAxw4Frlxf+Ka4eCgYKyhlJjePEPGuA4fPRXlAv4PsfSgq7HGVJ/DGNUqS9k5OljQR39FijrQwgai+8H0ImxlPo/U6rmvhk5+3lVoNR9c/paSLDOdVc/MKPO4UlCxdRaAAXXSghC69gVnNuIlEukIlG7UMtDCo5Y/no3r0cWKYPMVx+BUC9Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:OS3P286MB1191.JPNP286.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(4636009)(376002)(136003)(396003)(366004)(346002)(39860400002)(36756003)(6512007)(26005)(6916009)(86362001)(6666004)(6506007)(8936002)(4326008)(186003)(83380400001)(8676002)(38350700002)(956004)(5660300002)(6486002)(316002)(2616005)(38100700002)(66556008)(52116002)(2906002)(66476007)(478600001)(66946007)(1076003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?pSLzJThKcK6uu7xStXabpBU0ldt8GB9XAJwvfZwd3LungLsWQ6ZtsgKlKE05?= =?us-ascii?Q?OTwf7QBJ3IP9x3Ut48zZOYQfltPtYB+mpGE0/GH8BdPfnrlJ6JOgPm2HwfHX?= =?us-ascii?Q?/sNgrfolhSDhF2H0uMoqcF+3jHzt7uT9YzxlcudiANyJFOGOTaXiJUPKH7Zd?= =?us-ascii?Q?Du74Xp6Z5ENRTlr43Wwc1wLVkYrYjvsUc55OuViuOtPucsxq3JK281Hffi2u?= =?us-ascii?Q?1DGkoc7Ql7+MhqWxNIVc1Su0KE44t1p6qkCsN2uZC2BuDMx+W/iq0Hg4hdRg?= =?us-ascii?Q?AfFqxy0yN8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tEwh?= =?us-ascii?Q?zaIS7UQPCyILRzRK9WqZui1DmE/QHKN/wxbIn74ZQJgYfCApIq2kKgxcjH45?= =?us-ascii?Q?VNbX96XS5D0lHPvMvrvQSJjRRVhbtB+vCZ/PI0mFoaC6dtWV294WpDKMDDds?= =?us-ascii?Q?qXQqaiJm2B3yT4Cm0OtLGDWy?= X-OriginatorOrg: connect.ust.hk X-MS-Exchange-CrossTenant-Network-Message-Id: b22ff1d0-dfe7-4463-f59b-08d96eb6f8f9 X-MS-Exchange-CrossTenant-AuthSource: OS3P286MB1191.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Sep 2021 08:43:59.2886 (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: LwrJ7yizHy7llBmBBJcM47TLqrWCvtQrp/vwmmxSZBrfbX+HEw3gumQcL5oojlU0XeQUh1pXJXZoU+ocYG8HOg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3P286MB0740 Subject: [dpdk-dev] [PATCH v4] net/mlx5: fix mutex unlock in txpp cleanup 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 was not correctly released if the function returned in these two branches, which may led to deadlock if the function was acquired again. Fixes: d133f4cdb7 ("net/mlx5: create clock queue for packet pacing") Cc: stable@dpdk.org 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