From patchwork Tue Mar 5 14:09:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13582489 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2045.outbound.protection.outlook.com [40.107.14.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D07498615A for ; Tue, 5 Mar 2024 14:10:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.14.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709647803; cv=fail; b=NuJGUr7YFeioaGZOLpyX+6k1d/nNg26iChzC1ZdLk9m2Qjq6jDFhv0UyALzfNbnQCGKLz0R3gnb5KQBw01VKYukQOvnnWR5pwWj2TQJkLRgQl8erVW98FLSPlXEbnaO+lePfYvtPJay6Dtij0X3S3w4JlorKn87UMK8bOtdMllA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709647803; c=relaxed/simple; bh=Osbkb4J5a2F/Itw961geTUe1UJz7jXx23nodXqCf1f4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=sQR3Zt+Z3qKMGkb26Vc79PzT75kXchJmOnR+DZYZYAT56lLdg3s5S0lC6k4RmpqXkPZG84HmSbqywH3Z8/RPDW9HFyNWvePHxF4VNge53s1CiL6IlMRNnVRutfwkacV/PYNBvj+TlXHts8Rw5bYKDPKBrugquNaD8NexQl8Qoag= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=VkdHVsVk; arc=fail smtp.client-ip=40.107.14.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="VkdHVsVk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PUMBfGHmjnvHg6ISOztQwaYOAtI60o/0cvGJzowj5YryS0hZx8lbsuuhopy42K/qNpQZLGKobgRxDBIopNpVYNfgbnTJlAJZF403b6Fw5+tmee54CHJoaGpSyBkCwRY7R7OSyjWMq7r0fMTxXVUHGe+CSgYVOyfC7iEwrs7SnTTerRwLRPlL0OoTxtwuXULGkzLoiumPDogfgP5OFq0m5G4+vG5P7FKxMwFDJwOXxtoXgP4iRhO1I7M127H+SYOhIXIp64uGKOG9niSLOdvZ+qjYITCR60LfSVtmI2mRPoOJldEnguKJ/LHGjX5ZwvdFFC7/8C8/PB5Qln3UYVrEIQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0GN0fRcsVWbK1vYE7QfVnMywL7fnp/cyBYtO/qISJdY=; b=fR3UW0wcqdDlN4snZaR+HFHIYQwk9+iZrAccAgHAGvCtcHkJ8r/O366Mo1DYyxM+WOE6UQNOwHXLpOG0wap6F91gYsJRmexY+EKkBKgJ4T7HUtGblGGU5spQxOxB8DAAKh+69Blk3R98wZpguWQbpY56/mqsV+m1uFZZejHR3Gg5EHLfpxapxHMt0wGk/n3IbNHIl+N6Mam7W3hqHpDWxuad9oimrj06LLIfYLTBa/gv+thcwAD8DtbM1XIzDPfj5A+BB84W56kETqV/CMZvpazegE32K3MvRsk0PuLy0swqPaGFQICkr7MAbkOCQZB0N/B5ZygM2ZJr5wC9qdRRAQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0GN0fRcsVWbK1vYE7QfVnMywL7fnp/cyBYtO/qISJdY=; b=VkdHVsVkDnSGUksUCUFg3eaCWF1W7kyiA7t3tyUJmq48/8wIR9lN9ez3J62il/zVYArrpgfkr+yGi9NKjrhTg3xPIHStmwIyX02XS0agMaFZpdvyHDXSdTD++iPTE6jrSlCx+ZIsjDw2XxxsBmTGYagmcMi8mT7phCg5I358gw4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by PA4PR04MB9366.eurprd04.prod.outlook.com (2603:10a6:102:2a9::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.38; Tue, 5 Mar 2024 14:09:59 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::c65:a818:c6c3:679f]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::c65:a818:c6c3:679f%6]) with mapi id 15.20.7339.035; Tue, 5 Mar 2024 14:09:59 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH v2 1/2] Bluetooth: ISO: Fix circular locking dependency warning Date: Tue, 5 Mar 2024 16:09:38 +0200 Message-Id: <20240305140939.5090-2-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305140939.5090-1-iulia.tanasescu@nxp.com> References: <20240305140939.5090-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: VI1PR09CA0178.eurprd09.prod.outlook.com (2603:10a6:800:120::32) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|PA4PR04MB9366:EE_ X-MS-Office365-Filtering-Correlation-Id: 1be93763-ae7d-4499-a1ef-08dc3d1df167 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ctNS2xgmS8hRMNBTdAIyiJGRnI/TdlUfaVruyfWPsN0ou1RwPf3Ouk7HS9b2Wfqzp1YikDreJ3GcMhiYvmrJ2x5MlGKKvfOb39xED1VtyjlKUMJUyjeV6YwJwU42gD02PzfaDPW55W6D/iQvAVqz1HABsDnmJGpTkA6REevl/YFmqrkMYWXRpkOZHhn3pq/1coOZcMYJ0b84nydLM7MXWSMGimyZ8RWhgX2trWh/HqjtkDjbKnF4HloxkLpV3BSvnW5Rw8kyAfAZfXhKfJzldqcqODmVKrP+CrsMBrvSwdZzdmu5Bm6rFru+NpKtqk/dGUR+NkgDwfT3RXqLk3uXeh7X/SSrsTbDzGAZ724bcYsHTHA7q3A8zdhGtbUNIa7qARe5MEjmVtVC40e5a3OjoP8tx21AUHTMBqkwOSzcNl3U3/B9CNiRe1LF5pVUqFLVaDbmnyXiEnYzuNTpMvLV/puer2u/Z4lpcYMP+ZoT90YCHXQYk8HfitvoQHxCcaoboRWJHWlLcd2dBj3zOCeMlgRTFFMzzkSnq5dX0bd+KdF5tfKj49h1J7UIOedSiXZ00FvsYoiykZXnkLRXq6Jqc6D/34IqndY5wRHHS7ebdFfTo0axUMSW9ilPFGmyr/EikpUgx2tFBdYFY3XR6ZcMph6W1FiiPk8gDaZ4tLz++SI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8898.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Vxj+YELIMTbZfycRQ9iIJUCmQhjMhhsCafh/Mywnv+IEjDh4ZAxjgM5I9vTNaVgcWkd6wneyR9QNqzQcMOdjT5twhG0iPsXVu4/NFef6PxtzUH+JAZVup2S3/kzaozNgv5YQGvQqUsvpdCvqVd8EKpvL0A9ivpW08hEiaYBd8CXmWW/a6ZusiGU/C4iVXSw6X4FM4vnHipaLsuZipYyy6NiszkA5EQIFQOeU70yrMEPEX0QZALU0lPbpfRntxP5kpWTjkzEzOzICq0I7AAbkFGPS22z7hjB0e99Y7mAcQuS3D+kpqSXkK/O7aCo8g1OqM9ziwTKpI+xUcUaYXsvUWH9aEtd3rJT7HuHjMxoEeEk59ZtwoZI9qxodqzMqBWhso5AJ1ULS3c9n7MaRDKreYxZ/eSGkwFb9FtP2Z9zVV8PIpa7L0jfBFz1to0nwr9EGWRP+lZbXnnsC7MzFYQv51SH3TYIGIWmxhksFsTS88uZ8lILfaKpaLrs5h3ForjDExWkArvdp+mdNi/lltvMh5OlA6GZMZH6AEDKWbUH/q4Yk1MoeId2ul0O3WWQzoUvU0wtfQvZSmG7iPgvje3Nl2lB+VV6MtjPJlhMuGOX5L78jE9N5lIMLsUwV3B455tLhQfjZSDvf3doeexcxGCrHHnrcuRxdZTsU0hvTbQNGVd0TP9Ro+4/2WrgTVKxfuBaLa9d1jy/hoQbq7JekUtgrzuT09kvn3HuDKP+Qfj0hWfRrR9pA0rLPRwq1FdsganAlxzyRtg85A/LLk2Bp3PxqOjZauyjT6Mu7H8OzEqp7+VgOMhTAK4xlLnMhfSGlEtpHQuc3A6CN6rQY7QWEdLOOfbODruBOFWxsRNdsSG/O6/M6dC8K3hnPZqy2TlC4AlZmT4su5Q3PYxnz1ijB8iZrkgJfTlvxf7fC1zjDrAHM2Vu1BHg43F9enJA8eokY1eDKuptMtHeN15BgWVk7T6RGZ5XbWuVY4EdEqcdb0XohMu4wMmT7x30kEr7fQsuKzuev14PykQr7vEIDx+39niF3DelCqqSe8F8iUsrHh9IkVXLTfgHMrWYJ/hLSJkB3ay7hV+RDDjrz0Qv+YgFilieo4tjBaBFSpTkkD86G8XWh/KEQNXnVEbnVFVILXed7C5iu7WdN8ptq0BYgmra0uNuU3b7NgkQVsGNtLaYzyFVjnNPlZLbikEHsfU6ImwQB4K11cmkt8r+LSMicGQeMmicpzOOHt/cy1pzaQNkrkE/KhR7jXwJyf2yxBhJqv1RRWmYDHsw+Rcy3YqFCQuSWMmAEaKfsewoHcybfCGCEeEjRznVoI6xDFohpDJ20smEsOW2DZbqC4oweJES66Lu7N7TBcCxjrrBc2iyCn3q7ifXlVeKchdVBTWoTVSghI5NVXCLgc3SWgQHVTKS/24R81IFKQE6xvBotw/q1YK7B82nfQiFwekLpRijaIShtDJ9aAHekhag3lMCcLZR7L4ho3bMr5p4qRBR+LNuPCX4THgLKUNYFD8qmX+KOTo1r4kcMhQzOeNBGQ3+itVoiZenEMtQF1DmVR5xk+A7tVFD3W1xCXQCNIZzfGBjbmti5F8mLXHiL1MzZ6YdK444xMFUtCqo+DA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1be93763-ae7d-4499-a1ef-08dc3d1df167 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2024 14:09:59.4527 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4+hJDpYGdGXjwVqG54lIfGsoNpawWJEYmgIREWfeZaEa2o5XvnFWUN5pXXuQdLBce2eWmBKVfmCBjrxF15O1uA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9366 This fixes the circular locking dependency warning caused by iso_listen_bis acquiring the hdev lock while the socket has been locked in the caller function. ====================================================== WARNING: possible circular locking dependency detected 6.8.0-rc5+ #1 Not tainted ------------------------------------------------------ iso-tester/2950 is trying to acquire lock: ffff88817a048080 (&hdev->lock){+.+.}-{3:3}, at: iso_sock_listen+0x305/0x8d0 but task is already holding lock: ffff888197c39278 (sk_lock-AF_BLUETOOTH-BTPROTO_ISO){+.+.}-{0:0}, at: iso_sock_listen+0x91/0x8d0 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (sk_lock-AF_BLUETOOTH-BTPROTO_ISO){+.+.}-{0:0}: lock_sock_nested+0x3b/0xb0 iso_connect_cis+0x185/0x540 iso_sock_connect+0x445/0x7e0 __sys_connect_file+0xd5/0x100 __sys_connect+0x11e/0x150 __x64_sys_connect+0x42/0x60 do_syscall_64+0x8d/0x150 entry_SYSCALL_64_after_hwframe+0x6e/0x76 -> #0 (&hdev->lock){+.+.}-{3:3}: __lock_acquire+0x208f/0x3720 lock_acquire+0x16d/0x3f0 __mutex_lock+0x155/0x1310 mutex_lock_nested+0x1b/0x30 iso_sock_listen+0x305/0x8d0 __sys_listen+0x106/0x190 __x64_sys_listen+0x30/0x40 do_syscall_64+0x8d/0x150 entry_SYSCALL_64_after_hwframe+0x6e/0x76 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(sk_lock-AF_BLUETOOTH-BTPROTO_ISO); lock(&hdev->lock); lock(sk_lock-AF_BLUETOOTH-BTPROTO_ISO); lock(&hdev->lock); *** DEADLOCK *** 1 lock held by iso-tester/2950: 0: ffff888197c39278 (sk_lock-AF_BLUETOOTH-BTPROTO_ISO){+.+.}-{0:0}, at: iso_sock_listen+0x91/0x8d0 Signed-off-by: Iulia Tanasescu --- net/bluetooth/iso.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c index 8af75d37b14c..5ca7bb0806b0 100644 --- a/net/bluetooth/iso.c +++ b/net/bluetooth/iso.c @@ -1095,7 +1095,10 @@ static int iso_listen_bis(struct sock *sk) if (!hdev) return -EHOSTUNREACH; - hci_dev_lock(hdev); + /* To avoid circular locking dependency warnings, + * use nested lock for hdev. + */ + mutex_lock_nested(&hdev->lock, SINGLE_DEPTH_NESTING); /* Fail if user set invalid QoS */ if (iso_pi(sk)->qos_user_set && !check_bcast_qos(&iso_pi(sk)->qos)) { From patchwork Tue Mar 5 14:09:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13582490 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2051.outbound.protection.outlook.com [40.107.8.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FDF78615A for ; Tue, 5 Mar 2024 14:10:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.8.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709647808; cv=fail; b=qpEgow1xtGa0IQj6eTf09jPwcHPV6rP/jOycrgDrlseit3jZndYBp9d00Lfls/cWNzQBX9nja5E7oJSyUCTIGiHpY/J/GRNSZw/3PQLwigaEZZTQ9zwIbj1LZ838sxXAHOaHYZ3MB0VcG6LhpBPaB02P2WBOrnyaFfDIthqUe3Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709647808; c=relaxed/simple; bh=CW1qi/4FX90EmE0+ML18xZ9n/uk0cttZ2GhZ//t7kMY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=mgBIpMSST0+9fRJXCeJgZpFmE0LXgtrMp9d0Mknk9k6Ha/+CdKTYIw4cK2gqoHgBzbLMAzAwD4WJr8vVM6mzVX+hhFRY6cBO47EUJHHm9LXtTkN+mE8pmYJkObSygOd+EYoPRrjqFUp7UqVd1/KBBQc03ojX7MdTNEC1z5Lnxko= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=kFFD1aao; arc=fail smtp.client-ip=40.107.8.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="kFFD1aao" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZsH2vJbsXT8kAxqjuuk88QTzc7kAgGpO2BgHq+A2B0lS+gB4BVEeg9BSF4zby2eE5SqpdaxvjJORQlshPzO+olxD6nMhh/r1Mzu/pVUSnxZVVuOCAgy/LeEe2x/OYu8Tu6m/Rtd4gpRHsMbnrxVFo5A3Tm2YnZpjOEIJS4Dd06B1NHWB/McGbDCsuMPEPG46cRyh9VxzBIju/F2rUy3zNpoFR9XRyEATniEjRMWu2cXraWAXXbZpyNxQ+vrPaao1KUHPVFWxH3BywtdlhRm3s0o/qcmULl/wLMDsg3DenWNvX0CRHrPoqW87YUYnu87Z2Z0ospkl592KxG9duyCUPw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=u9s9kCEbDFisvcTOMvxfI9WEpwDB2cBJj70G5Uv4MYo=; b=SEoBqdpRcUZoJ920iJvTzpeqobix9igjgXBoTUC/xEDBWcO+zu0BcsocuNmgVOTE4ulucQuxUn55qQdqJzrUuFRfkNKN0+/llT8E3dVyihhe2/XLU0HIb+ZmTRyo39WLrc7Sl1+7U/XE8z3lF8UldZvnrc3YRaGR/PWpk4WgcCTg0/VLb6PDsAiHhRbDfvMZyZnhB0PfBnYZEmkSx7tCy/33OME9h0mTD5GzUqPsZFaigZwU2vGc253nbnNOjjFYr7+6VfBXEyCcH4FFx8/lXGIFowQuCiMaTpdoD0+wH9fsyj3tK7MLhyvkEhA9t1Y1RzUVBlGFEkZYbNqYeeib8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u9s9kCEbDFisvcTOMvxfI9WEpwDB2cBJj70G5Uv4MYo=; b=kFFD1aaogDGm8a2ZK/Rlv1wMb74md4i3I6ZKNx2sALnRVdgiQr4dW3cMLHh4nLfYSVWw+px3YDz/acU8ceTBSkSmv5Y0cmbwGwK2pyL2gWDptVB9sD/YlOXM85NGfn/+IL+KmkemnhLNL7dTtaJtU+kJEK7hcbmDxDTUeV+Eb/s= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AM8PR04MB7410.eurprd04.prod.outlook.com (2603:10a6:20b:1d5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.38; Tue, 5 Mar 2024 14:10:02 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::c65:a818:c6c3:679f]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::c65:a818:c6c3:679f%6]) with mapi id 15.20.7339.035; Tue, 5 Mar 2024 14:10:02 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH v2 2/2] Bluetooth: ISO: Always release hdev at the end of iso_listen_bis Date: Tue, 5 Mar 2024 16:09:39 +0200 Message-Id: <20240305140939.5090-3-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305140939.5090-1-iulia.tanasescu@nxp.com> References: <20240305140939.5090-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: VI1PR0102CA0105.eurprd01.prod.exchangelabs.com (2603:10a6:803:15::46) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AM8PR04MB7410:EE_ X-MS-Office365-Filtering-Correlation-Id: 20eab53e-0251-4c64-4826-08dc3d1df357 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6uk2ODog/RhX1JBuKEsFda860CHN5GO0FQS+4TV68SU0PwMldnJvXVf87q02AOzg2gDSci2jTUkMB9bHwY2kaUvx7ewyHdTff91JT5D5is20+2hkwh1tMWdZWoq6UfcWgeCSASZoZRPl4k2h/tKUrR/EKTpK3DMFXLajJ1rbAoTIs+KMKKtbCBLNs3Ucl93rwXyFDcgDGf1+3ntXI81DjXBUjL0rI6bLDjoSjsv58r3ObNPo1LhtVF2vWs+O0yYj1Ib59HyvURGX7RLa/o7G+T4xUaPnVg0h81uwibmFqUAlQ69JXg/Yii6oAH+ozQne/xs6Lpq2R5d2y4PrhFhShagpuCjGVvBPdeobvbGzuk/J8bx+YfGRNs5Jn8g/yMp2/9L3KbHbhPuzvnB1RIfFg0aaZ1EnMSVdDwzRMBFW5n7a8+Zg7yWAt/YMh3UnITccYRYopHmemS6uRlItdsL641fT1g3dcQtUEW5glLX2LIxx8NReS+mNiljkz39uIp6ZdjjV+1QEUzKQT5wds44j+jsZ0caV3g+DwtCuV848PtCkaN8yB3hCqJbkjQkcC8YeqX6k/ZU1hRAJyAqMq/8Z9nBdmZ7yQQgBG8/RbpQpokVuwX8LCqdLDZBTGyG+ZzN/3XtLlDO17X9Nv9CzeRSftk4sIuqH0SCNTV4XhWjRzoQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8898.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: du1mGbZ79f4n6Nu/lcctr0HceBUsU4unfkEzc9aN4dA1oaG5GxBkriJAJ9+Dq5YfzKzO269+jaEeucjPXlYNLwUpi+KaGFT0ggmuVE4knfaM0cu/sE9qmqRojXv8NHisO8RA15DcJZcR2jOzcnRWn5vihr1wadb25z64kfsH3jl7jybSEf2+j1+3Bg8UjT4J//7DeLvTDYGvKO4aasL+sfonC1GO6klaU+MCypDLsgYPLhFl6iIRHcAYNi3H1MfgEYH6puzSpcodT2/1Om6DSYm/y82ZpgTjVK5BhIUfeIvmsOVyiA22H4K5DXJYF3wmpDcGP7ixX9X7lEyQsOxHO3spcA8S3zynEBk+2kOxviNJADoy7AO8XlM7RvK/ms+ERzKTgXPzba6OPuVdRDiTvZ75O0xqoPCis11V8fMDhY6y3FC8UttuX8FQwTMh2wqo2Jr420uQTVAN70O+lr1cukE4F8St96SYhMCz8FOMt9/RUkt7ipTFEAXy8+lvk4OhsDVDVNScxNnebGAgg1PE+qLDTyVk6FGbTPRW2PDpwhv//ZSYawxBJfBVv5BNiL6JrGCh39lHbh6dbkOSywRHZFm/CX9/X0rghOa2U4RfLLqvQ5VHhVpSrZxNkdArOYyv2aEE+nji4XneAfEiBCKuyyNEM0wi6kISgwqCIteS4OS37UtXVggyuxyCpjJQyBH6sqKrQDXteZ1iRQXl7P3Xrcx12vM8hY0i4raa6VBRcHihA0mwgevyw7y3h7dHjvvsx8L7GlA1QL0zl3gPpejppJR1bPPHq93ihwE2+t9xp7nSNJkNgbB+Pi2jcVIf+lhR3WFvZ/manLR65FrnA6vZNyzZRzkNcJp+RNk5pdqmZudKhy0igVaCBuz/d3IQfabnM4FIlNjF++8jpPueLxv5JrCICpVWW+uZ04S6kR1/vC6fn/6YzaGShXwU7gl5twU1P53e11hYvvCJAFFidYqsjj9IsIsQtBiRvOjKBDwVdM303u1XkRMrk4N3EjN4xZMzyy4HAhrrDGFdqYG6amvLGP+EF6fVJIxWGVAktqv9iBFPU/zdap9Ys0U175hG9zsNfzBMI5s+cgcnjwJjRe6WE2MVhDDeUii4TKzC2vCUpB5+qcqKT/OSnaIDylYn28jH+g3QH7C+q1l1rWRALMDgwHEvlyZJUSFdykitsH4s7DE0ssupSKB+xKF2zwP8mkieg2gfXCYqzlhXW7ltwOERhghuzkSDP0to8Bmf+cJGsKTuAUEgaDnMPAc+122EqcKb3q6aGp42rfTwV8H3nWwxegi5AaRAAvmsgFRl6+M14oe1mWT4X1K7NhvxDOA+2t117jGfb5k5ZQQddbsZcTOW+bVBfA8R+PtQko7HwH4m6f3DdAQOTRsb/wS4E6WxJvF+MyoV6Znfd5FCvCy2kH7nv4e7v5Sq3dc7Ds1/UX3DSGT/jLyD0g5JW7bFBbgq0fq8G72gGaFTAxrOoRxnwg0dR+F6ac5jlBeggiDcS3b9grjSap8MPjKWESudhrMB+K8l24VlRV30siU1UHYgIf0BEATYU/Se1tZCyFyuUtqgkYtPO9eH7MyyrfPIk8jFDgLgUbeM2H+t1mgftcD7kELKYA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 20eab53e-0251-4c64-4826-08dc3d1df357 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2024 14:10:02.7501 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Q3o4cgrUVLG4acW1mykeR5JvblZtb9o3faL4n8YTxWKgbhxHxf2faxH4YPVI0mG00RRUCvuGTX981YkNCgqQ6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7410 Since hci_get_route holds the device before returning, the hdev should be released with hci_dev_put at the end of iso_listen_bis even if the function returns with an error. Signed-off-by: Iulia Tanasescu --- net/bluetooth/iso.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c index 5ca7bb0806b0..336c28cea3f7 100644 --- a/net/bluetooth/iso.c +++ b/net/bluetooth/iso.c @@ -1128,10 +1128,10 @@ static int iso_listen_bis(struct sock *sk) goto unlock; } - hci_dev_put(hdev); - unlock: hci_dev_unlock(hdev); + hci_dev_put(hdev); + return err; }