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 D089CA0547; Mon, 30 Aug 2021 19:23:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C561141150; Mon, 30 Aug 2021 19:23:37 +0200 (CEST) Received: from JPN01-TY1-obe.outbound.protection.outlook.com (mail-eopbgr1400131.outbound.protection.outlook.com [40.107.140.131]) by mails.dpdk.org (Postfix) with ESMTP id 7F0EE406A2; Mon, 30 Aug 2021 15:31:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MSjgMxGMjPjFajklgGpDqPQhXQ9f3HYxu/LHB9XR4qk0CzfDDYkRAcKX3J6z2DiG2zT1puGWibzaNX4ozdbMk4cdtErAYteojQibOPxEa//lNL8IEEp6asRWOJdkvGDGAUwyq/ic2CZiahuqqwCqyLspsfWFhJ1elvJ7J6AKL7DV8GEVhubRWe+qFAG0d9hyDYjU0wSGSmSY1wMQ0YPkvEKL92HZWYe/UbTAy2cLuVGRKl4keq8uw64q+99Amkt7GXL+LPBJSOh3EY5t9Jj7Dd9V7uPWKzZLn6mVNpQqvhk9T4QmIdYFl0bEPfv1EkQvW+7oJNiqZDJ7sJnVZLfbSQ== 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=KLY4OG5wguUv5kT8PurT6wxS1u9ea0KBWx+4mnwqqQA=; b=f1w/hNjenBqsCbhrYYZf+zDJiasIhxK48e8PXi9LIGUviJ8qg2egUuhMtXs1+JEx1rUo+lwt9mzX/daXMfIrnBtedobDTl+HfXU3hNi8ncMSvaGpyHf12SboPq4QcsrTjBs3bwsArQgCKA1uzadVjrAMDUlYAcLjIy0XPubkjZiDqz1JIgYyhklgqVTLiqlN21aObvR2V/yyjgYeV1Tc83GjB2eSBt/yk11yvH3ZLz3g6Wi+1/2g/B9g/9Qkbji/fz/92OV26t3jcJIpBaL6lZYBtu8zzWtprZW0vUYRsHOv9vj2rbH8bZmkl4vzEfYZ0N0So188I20jxmLqptUKkQ== 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=ZyyIvWMTAZ13H4cwDpgrxGPf4o3EiXAXRQMa2KteOOtFFmlUqTLSS4yaUChElLRcG+2nVwzk/djxOprVU67aHvwkY/wAqNjP/fQpwj8LJLxkTPFkvNnRJqTYaT0qFDd0KriSQAQ3ncDJIcWgfhLmoLW+1uB6bvCJkRsobrtsCOY= 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 TYBP286MB0080.JPNP286.PROD.OUTLOOK.COM (2603:1096:404:802e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.18; Mon, 30 Aug 2021 13:31:33 +0000 Received: from TYCP286MB1188.JPNP286.PROD.OUTLOOK.COM ([fe80::a422:ce1c:134a:673a]) by TYCP286MB1188.JPNP286.PROD.OUTLOOK.COM ([fe80::a422:ce1c:134a:673a%6]) with mapi id 15.20.4457.024; Mon, 30 Aug 2021 13:31:33 +0000 From: Chengfeng Ye To: asomalap@amd.com, viacheslavo@nvidia.com Cc: dev@dpdk.org, Chengfeng Ye , stable@dpdk.org Date: Mon, 30 Aug 2021 06:31:18 -0700 Message-Id: <20210830133118.9615-1-cyeaa@connect.ust.hk> X-Mailer: git-send-email 2.17.1 Content-Type: text/plain X-ClientProxiedBy: HK2PR02CA0135.apcprd02.prod.outlook.com (2603:1096:202:16::19) To TYCP286MB1188.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:b7::8) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ubuntu.localdomain (175.159.124.155) by HK2PR02CA0135.apcprd02.prod.outlook.com (2603:1096:202:16::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.19 via Frontend Transport; Mon, 30 Aug 2021 13:31:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b934da70-7d0a-4450-1aa8-08d96bba7b65 X-MS-TrafficTypeDiagnostic: TYBP286MB0080: 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: 1lqq+nNbFjDXpE0mMK8c0f4m2AxF4tgKnsoQcR1q0QLT8c74Tg1osF0S32idXXOdENxnUT9qKexG2pbp5Evf4U/81uUVnjTulPMDucnTrVT2H+LqLHpByZK70NJivyjPRVXLNegYwAAM2FpM5/3USekobY1eFx4C1swQesHuKUXpmmAdVkse+sUSZAXb6KoyEhFLyyGxut3MO7/HE3t0Ce0BeONYmy48OmmPsvaQ1YuOmAKAYblsu0Kw3D09HfFLN2EM1lu+fnJ0U4CjPvvebGtvQIIWNs0KtsIuG4yXUCfwzMef6e5dnrjF+VsK/6D1NsH4PkINsCxGJYKTw5SuutOj6BJ8bFO9V86wE1ciQFtJhuFQQQEsO7vaNDHz/VOR/ZvEcGcpqPOAB2SDd0O3nhHDKXHOPW9WxN5q00YzvdFZ9Kx2nF4xNZJjn49Z/H73vFF2o064D24ZUWMq3UKPnIejHwbHw5nEixSUI6TcAfvTYCYncE+kC40fQ3fV7ofdZ4zXfzmYA2TpSrAeIy6H6Q8CRWUwy9hHnRsdg5UzTD6q6D0ZLu5NACxhTShs6IN3pICXbRvSxMKa1ATVyuMQLRRtaWIhzsubHNQhcqDjmAUyght3VOuAxIXj/V0iMNGUHi5vVBPggvC64hjVRQrRtfZu/EA2UsmclI5vdHQ6kf5Kamm1+DzgiyA88Fok2wUE1xFXp74OHnJwdFEVht3+cQ== 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)(366004)(396003)(39860400002)(136003)(346002)(376002)(38350700002)(316002)(786003)(38100700002)(1076003)(5660300002)(52116002)(2906002)(956004)(2616005)(186003)(4326008)(86362001)(6512007)(66946007)(6666004)(66476007)(66556008)(36756003)(8676002)(6506007)(83380400001)(6486002)(8936002)(26005)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?TvyQ3KvKk7bH5dG02unZQ+bhn1xC3nPZaST7NcwQDALNFivNU+kNa+lFZk/G?= =?us-ascii?Q?p1L/G3fJV3f6pPlfC5eHR8h481+jrVRS8rz7nUEY5L0e+iuGxnYvRgqHBOLZ?= =?us-ascii?Q?Q0zCnqG96kmuGyliOQzKWINhBKE2unG3iUthvqoSdFIwFNk4QcL72q64AZaa?= =?us-ascii?Q?leR/1mFbipbLcO9s2ZUw+lrc3Yzfk5dDMo4G7ky4VCWeOxF9WdvPWffuI49C?= =?us-ascii?Q?DQbAgOZcZqcVDrYKUNli8lubHDRoaBPrqRCHalpQrg9qkENjSDR68rvFsRvF?= =?us-ascii?Q?xlkj3gC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h8D4fzwGQDjiOyUHaBXV+tpxp?= =?us-ascii?Q?mSaMqDrIJbF/PraVfMKQXXrCbOB1Arx9LPnw8RLUOPAA0lih3QVrR/LUzHob?= =?us-ascii?Q?4KOPyQYhnDpE+4W6y2hhfcnCPbgXr23hNvUA9ZUIQgX9ZO5Ztby0/hHrZRWs?= =?us-ascii?Q?wdIBepevh7ZxOYgZNjZFfHt3?= X-OriginatorOrg: connect.ust.hk X-MS-Exchange-CrossTenant-Network-Message-Id: b934da70-7d0a-4450-1aa8-08d96bba7b65 X-MS-Exchange-CrossTenant-AuthSource: TYCP286MB1188.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2021 13:31:32.9780 (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: KmkjoQqMfoWVtMD1PeOX8gXG62Qrwg2s2xb7fiE6pA6S9XG1YMxD/GSDl7/r6sB+mCnAa7ve4TvmI+sNVmRwUA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYBP286MB0080 X-Mailman-Approved-At: Mon, 30 Aug 2021 19:23:35 +0200 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