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 07738A0547; Mon, 30 Aug 2021 19:23:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC56F41141; Mon, 30 Aug 2021 19:23:36 +0200 (CEST) Received: from JPN01-OS2-obe.outbound.protection.outlook.com (unknown [40.107.141.113]) by mails.dpdk.org (Postfix) with ESMTP id 1CC8840687; Mon, 30 Aug 2021 15:00:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ok/SZoKBXIlUDbb9Ea1OJG9eUR8Qyu+e54zsy/kyFnTcKWjC46wtmJGsJQzp2fv7hquXz9kqXbQwbDuqyHsxogLTzDa4lZsoOpnn98OHZnyuqFVkc07Rr+8u31wvbd1/vCvAFq+BQLFqtN1LUqATuHmSKPX3xGwL2sAEdnGlM3EXc34dqV4DGWZSp7NSyhZ7p17mKYt89EwYY6LEA5eTK/h3bF0P5pz9rTS7Rla5e33PLVt1j5KMulqnpY2RuoSJvbK9bIjCRUGWLICWgLB3yq9Q+OxnZEOk/D9uJoVxHcWe4L2coAYK1qC7/h5klnKIH7RLJ3OxtUyb+QAGXcctNw== 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=6N3u9bAhwA6idO950FYeIC8ymJ4NuLoAvCIo/LlAp3k=; b=kbueLVjRiMqKhWLPLZJLS4mLWoVqDN5TR/GENrRLbR57779I0liqRGPpAZbV0RtjuuunE1vLU9fhm8oHwS/GQ9SHi8X4nX0pn8A3AQd4pzQ5IvHLXDtA/uqpOvZiJTk2SEVRwcmYBK+++b6PusGLgUyPVNchU5G5gwe2Z9zjxlyx3ch3nWFx0PaI9pym9tSwUazkhUw7jzAh6a8LHBCypjtupof9CS9gXSB+RsKDI/svj/vg9siGXiggLjLR4em8/g7V+jmWSwgxPyTdVu21KKOmrWcjDr8cuBJENS0T9ihGRfBFLQ+fqJoIpNGpno5MdVs/y/efm9G7cEKOzIgiCQ== 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=6N3u9bAhwA6idO950FYeIC8ymJ4NuLoAvCIo/LlAp3k=; b=QPIkky0VA8mCOT+k+3PG+6YFf2vWmWXxVLkc6XiVwpljRWiw1IjMisuuvE1QdTp7mHrDoY8H1aH5M5RZ+TstcP0UA+dbCjEcg6n+2AyM8xDF4uVeJoRmUUEYF2qTaK6q9UDY55c27GZ9qTcsXS/tOUKbfdRUidg3hGHkhpQdh7U= 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 (10.242.2.232) by TYYP286MB0985.JPNP286.PROD.OUTLOOK.COM (10.141.91.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.21; Mon, 30 Aug 2021 13:00:31 +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:00:31 +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 05:59:55 -0700 Message-Id: <20210830125955.4887-1-cyeaa@connect.ust.hk> X-Mailer: git-send-email 2.17.1 Content-Type: text/plain X-ClientProxiedBy: HK2P15301CA0012.APCP153.PROD.OUTLOOK.COM (2603:1096:202:1::22) 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 HK2P15301CA0012.APCP153.PROD.OUTLOOK.COM (2603:1096:202:1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.1 via Frontend Transport; Mon, 30 Aug 2021 13:00:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bbb13449-2007-40dc-72fd-08d96bb6259e X-MS-TrafficTypeDiagnostic: TYYP286MB0985: 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: MhLgSQh5TFMdyRbjC9Rsscd+ok2wCsGjJd+WqVQ5wOwpHxpNxQY7T+wnzY63rQj0XuRicl/GuizcJ6BfnIPwvxRgasK+MzNRwAi6+ftYvm5RNgU0hiiJIY4ve58UTRw4qyAh4ceew4y9ufnPAKPj0SDuY5hfMPyYGQqla5jT5oks8mQJbxNOlGRvLxkaSt8ywgwUymFD1ms+8QQP4Kl/NGV4OOAGSM9nuvxcnc6U1GcrXscnFajvRdglyMMGoRO+8DmtrG+NgGUW5B5ZcMLOLBmTSnqh7MARKIUFnKHxxDHef6raEREDhIwKnGp7nQUJvPYl0uKPfXsZOpBFhOnNqrTYAFxXSmpPVViwJjd+E8BPnp5DtmXWXahNU5F20a4GYvUPEN/aNFttOVI9qPrKnD07jlsvyF6gvJlBB2iwgr4QekGPa3V1ENUOMzK6f2PWjf+PXFSoicIr8pdqBy+fU0+goJB0oI7Znr/sk3mrGk8VrX8L9d0Y/yPl03J5MrycHmc/GzVdEM9kVxGo0ZlKB3niAxRCP6peZI+2ESHszvPT2nQxqSW0zXCXD0IPMncw5+pzeO9nxc+RGwzOFKEZexURwZhZcRbl9iy083FMnUtq6bJGEzvq/+WFmUkMV107cTus6XyDBG22ciUOmeOHqPtUUioJUC4DPmaOFZe66C9ay5vR8FZIXJgxcUoHjHx+AJ24tNbpLDG9V/W8AvQtIA== 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)(39860400002)(396003)(346002)(366004)(376002)(136003)(8676002)(8936002)(26005)(186003)(2906002)(4326008)(38350700002)(6506007)(1076003)(36756003)(5660300002)(83380400001)(6666004)(6486002)(478600001)(66946007)(6512007)(86362001)(66556008)(2616005)(38100700002)(956004)(66476007)(786003)(316002)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?m0otLZ7JAXi2reWtGJACU/NRmFT5UPbr1jzxgMjY0F/kc5tEsI4hMPYcEaXA?= =?us-ascii?Q?Boeksjpr/XOWO8S401h5RpLQLNYW3XJt4deUwZ1YV3PP2Tn+ZBkoNa+0C+0k?= =?us-ascii?Q?WMvRC6uPYK7N2SLIQnu7TUUjLenRGPFxDznR0Cjejl0/rvPyDkNDGrzJ6VbG?= =?us-ascii?Q?VkNcimdOeeKmfiiMsBrTJYjhUTOH88Pd12sdGDsUzmKJaasH4SFERE2bhaXd?= =?us-ascii?Q?kh/Chp1aw8AIXKn1J6hqScfWv1mpkJjZ5eCAs2Y7Qh9R8bO/ubTYHOtr/ADh?= =?us-ascii?Q?pafaPtHBNvFIAYCLZS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?= =?us-ascii?Q?3220tmFz5p7Vke3TDRLIzbHrDaeEzyR7V1aNx0Hb8VME8ruYWeJdQIRUIDDC?= =?us-ascii?Q?PFvhovri0IKs4kYFH6rrQZTorwQLeQzLZZr4qzQ4dJIeiJZvJ1qwuLH8dIDK?= =?us-ascii?Q?rFwJx1PUQqSASgmf8Fk7aOCB?= X-OriginatorOrg: connect.ust.hk X-MS-Exchange-CrossTenant-Network-Message-Id: bbb13449-2007-40dc-72fd-08d96bb6259e 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:00:31.1356 (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: qPQQMNddk77aIzc/m2KRMwJVjqruVAX8WCpQRV1B93DkFpP/u2ulylWbr4wLgaIkgPZuoNur/RMirKEjqDp0nw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYYP286MB0985 X-Mailman-Approved-At: Mon, 30 Aug 2021 19:23:35 +0200 Subject: [dpdk-dev] [PATCH v3] 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