Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2707278rdh; Wed, 27 Sep 2023 10:11:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFoZiB+De+w5cay95pTrDXFK4znxiYzpduPSNS9jPEEeAKlXZGybWR4pLFNmhWauHmQ/gkk X-Received: by 2002:a17:902:6806:b0:1c0:b84d:3f73 with SMTP id h6-20020a170902680600b001c0b84d3f73mr2147657plk.53.1695834662368; Wed, 27 Sep 2023 10:11:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1695834662; cv=pass; d=google.com; s=arc-20160816; b=gt27t2SJrucXuYmY++lWEQwJ+9V5NXFZOvw0bx+zzJb4d1KOF339257gcItFk1uTB9 qlN0Vhq6MQ9+O8EmLIsSGrvUGLcLjb/RpToNChVRFLT0PRT0o8AIYty3HKZF+ucCQkcW a40RKneLeMaWh7tJ2u6yiNfTU483uMy8DdVpalKaptEz/6YNLt3H6qoy48S3zBHFlKri fzGeGH/wXMR6NPcmvAIXt9JH0voFIFQ9gDmIjWi3ffSM55xL0Tz8FlKkRDA9BAZnASJ1 AOFAXawfSClvOWW5yYXLHdIeynL84AhWZKPrqELtQN7vKC5RQo2NB9Jd6Uc79JabKn/J y/cw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=edlstyItnaYpPOYhvnuuwBni0oQQvaqnVYI+RWLV9dM=; fh=gOZmdXQWWYi2KI/CDlaL8bHElbVrtxjT8kPXxzTdvp8=; b=l72RCAmUzVzqSlpuNMZc8d9260DW44b8G9zUKicIOdJ+WlVUbr4gybxPIqRVi5DpQ5 v9Uk4XK0Hm2B30hDst2/y2T4EL4TpBXepQx1fmF5hArOTNltLkAwPvLLrU9hkN0VFzpY vY5+rCuuPcnWCy0sd2PeVyJcL+rlDWswJC2Anx8/Ehv4hpm1MNYfToRny114lmKF4alq PYyIay4RXcMvQHcFWPEEDOX9tfs7xIbCT0E2wlNqGZ64aVWW2vZIrSrR+UH9PFXs2Ukv PrAYCKvA5kNmLZ+J/52WRdqlHIi2vqhsPf8IE6ImzK42QdkoIOdpKZwLIj8dffnhahEj ypBQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=pZfW7ShM; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id e7-20020a17090301c700b001c62b8bb043si6510856plh.407.2023.09.27.10.11.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 10:11:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=pZfW7ShM; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 04AF2805B050; Wed, 27 Sep 2023 04:38:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231420AbjI0LiD (ORCPT + 99 others); Wed, 27 Sep 2023 07:38:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231391AbjI0LiC (ORCPT ); Wed, 27 Sep 2023 07:38:02 -0400 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2046.outbound.protection.outlook.com [40.107.249.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F230E19C for ; Wed, 27 Sep 2023 04:37:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X2ZqnwxpK8bUXEI2yWZNgqPdPGg45Rj2z5crLVWtz5advj8Olp5QU5STia7NaW+IAfsRIjRgInNGh18elLpkDV3sV4gncO8lzmhxdK+QYcwetYdq8eM9QG6WcygQAenQh6pyGwCdb2NaBNNf9lk6sJ7KALSFxSLidYWTGKQedZuzSe1WwVIfLVimdsY9n+D0INptx74P/lqnqNnuYH5htLhZWAwCuLrayhxiYPRGpgdX0T6NIRS7ugwe/yy2qUUh4mJUa6xm3JrUu5UiujSiieTbTfEQEDR+JrxHPtaxvb56m8NXjWUQ1X9WLkRokKOQ4OyX/Ttq+GmR56Yykv3tYA== 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=edlstyItnaYpPOYhvnuuwBni0oQQvaqnVYI+RWLV9dM=; b=MxUdBA27DkgBXJ7EHji6/9PinyqTReZVkOokqu8JMrwwSvSQeAbdQtaPEIa+OmCQdk+hOS/2z5ukKldBuzxDONWjReehz3nRAswydZpEPkAgW8kFSVL1yPogDKW1v3w8fkYTMk7dms5Hs1BbEclE5HBwr/LWKXUP5hqNkKVXzDgit7ARvHQ06tYZ/VuI2oGDIxGPvbwrC+XXmbgtYsKCyjovLFWfH6qvbyVaEXVBatm0SKbBJRT01IGAZdVGFkGLEdVOCxCLUX3+79kTMMg3bNOSKL3tQoHCB9zC6VmpfCKGCIVdkQjNMw7eeKekjKUxJ1eokXvv+Nrn+wW3Q65FCg== 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=edlstyItnaYpPOYhvnuuwBni0oQQvaqnVYI+RWLV9dM=; b=pZfW7ShMX07Php6lQJ9kwZcsfDehxm9CpdgOGY12g9WUyzZIfcJq1hHOcDJNZREOK35X2EA8IPBjcFQHGkMsEovNgtmhvgcQZYLYYLatNwgdIWXCt+OKva5XbmZsLLdqIQ6Ea8UVV7LhNoc4G3vmTt3WlxhghWlCBunssT9jeNk= 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 AM8PR04MB7826.eurprd04.prod.outlook.com (2603:10a6:20b:234::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.23; Wed, 27 Sep 2023 11:37:58 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::7763:779b:1a89:47da]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::7763:779b:1a89:47da%3]) with mapi id 15.20.6813.027; Wed, 27 Sep 2023 11:37:58 +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 1/1] Bluetooth: ISO: Fix invalid context error Date: Wed, 27 Sep 2023 14:37:39 +0300 Message-Id: <20230927113739.3332-2-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230927113739.3332-1-iulia.tanasescu@nxp.com> References: <20230927113739.3332-1-iulia.tanasescu@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BE1P281CA0481.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:7e::14) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AM8PR04MB7826:EE_ X-MS-Office365-Filtering-Correlation-Id: e5aaa54b-57bc-40c0-4d25-08dbbf4e3277 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 35WjvLKSQuoKg5Qu9SXiTglI2hwGJb7NDtg9zGDpN6wvAUKT31BRbMys22USkYEV/0GsLMwrOMILPSIKL6QAX/qqr9jaLIlWcI4VbAwzURjVG7INlpaRqT/h2BQkNUmWi7MYiKDusqgrUx8UAOvgcFw1Q/gU3WUjMp0iRrSeWzVJsS3ajQFtuf0IMMXNKvUmk7lV8dESLYqBMQ9kVGvDnUCfka9AWbGBAkjmPo2DBPQVq/NPIZwEmNttHGExFlmtYJ/VIIGDV/P97MsafLXvy8igW1QyDjD58Cse38usIB2sDcZk+edBw/IOO1JkwzGjMgY2pHR+f2J4icfwq3K/HW0qDc6PXb9WOlzKK9rEhRQOem+XDu3Sajx2hPLVgGY9hOw/IZkwiUJRut5vzusvVT7EqdEroNZZEBRch4T09JFrK1WATa2kTsXoUm3piZohqGv8+VW46wZHaP5rGrzkU+fcsO4gyEn/Ac9I9Fb+sMz0JqiZ6D8T5Nl3na14TXHCp0bbr7+QRiPUZENMUvH4iTDJnW1WhStQKmDG5vdYvEcnZE0I0xd5zfi8fOWW9wo4 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)(396003)(346002)(39860400002)(376002)(366004)(136003)(230922051799003)(451199024)(1800799009)(186009)(6486002)(6506007)(38100700002)(83380400001)(36756003)(2906002)(86362001)(26005)(6512007)(478600001)(66946007)(6666004)(1076003)(8676002)(2616005)(4326008)(8936002)(5660300002)(66476007)(66556008)(6916009)(44832011)(41300700001)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?bdX6koQVu7wAbJPZveqFr8/VCFXs74P1PWFu4cDXmmEK2lVpbghtH02HzOB0?= =?us-ascii?Q?O89/H1cvt6NE9ddst/bJSkxUS/P6WEwXaquJfvRsR9gekBbbMiFzJvpRNKkh?= =?us-ascii?Q?A95r8N5aeBjMV5wSZVSQUV91EeU3Z0VeEsK4GZfSdxreCqnVunuVG/LRTiJL?= =?us-ascii?Q?moZ7ZLqsq0tXWguAkf6I0waYS+y51fyOCuachZzTtc8uN9JRiEqJeuUdq6Ef?= =?us-ascii?Q?HV9Awb6c4Fcn/opkZLbR/1IEDbiHs9mP297pEiFh6aFZ4fL9b9UBp4gBh2uL?= =?us-ascii?Q?82KPzAcDv0WaQcM8s9bcahVYUXKKxElaQwBuZyo8BOdgxGY9QhPG6FbSSZWX?= =?us-ascii?Q?6PvWrh/nhHixo3hEksm5ITJKEnDUEPbk2WIU5ulyGakeobWTTbyc4Iouy63/?= =?us-ascii?Q?+zu7rHOsgwgzw+qINzbUniuR0jABcfoyHHtSGJATVhSCKh8rTKp9XI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r36/gwtTFeFiNXBvRNxEQVLQMHQp?= =?us-ascii?Q?7nJ7iq0pV88oX1uOaQlQ2Ca7jIpmo5WiaUgqAuxnMztJcTwyX/JNLtuRD91z?= =?us-ascii?Q?pqT4g07kM8Z/XAhuHtPnyUxEVTYdosbeF8Yc1ALldC6QAIktp8Hc7gMru0B6?= =?us-ascii?Q?uR2PCuGIqcbAaKahVCiJQYDxZvJIoLV1eaLdh5ftCiORk1YXs5ZpvZfff6wl?= =?us-ascii?Q?WSlQEOZ4crnEsSZ1cJtuoYkIjURGygWoEPMEHmOrQqXXv71UQV3pFvHGS2j2?= =?us-ascii?Q?UA=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e5aaa54b-57bc-40c0-4d25-08dbbf4e3277 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2023 11:37:57.9515 (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: AW9AU10Act0kt4E9pE3o7y6TclPcqTrK71MyXe0J+aaU/5kBhqBvlCY320lKYmx3DkEBHyX5/6CZWv7iFu2c1A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7826 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 27 Sep 2023 04:38:07 -0700 (PDT) This moves the hci_le_terminate_big_sync call from rx_work to cmd_sync_work, to avoid calling sleeping function from an invalid context. Signed-off-by: Iulia Tanasescu --- net/bluetooth/hci_event.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index d242f956dea8..640921358e5f 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -7020,12 +7020,26 @@ static void hci_le_cis_req_evt(struct hci_dev *hdev, void *data, hci_dev_unlock(hdev); } +static int hci_iso_term_big_sync(struct hci_dev *hdev, void *data) +{ + __u8 *handle = data; + + return hci_le_terminate_big_sync(hdev, *handle, + HCI_ERROR_LOCAL_HOST_TERM); +} + +static void hci_iso_term_big_destroy(struct hci_dev *hdev, void *data, int err) +{ + kfree(data); +} + static void hci_le_create_big_complete_evt(struct hci_dev *hdev, void *data, struct sk_buff *skb) { struct hci_evt_le_create_big_complete *ev = data; struct hci_conn *conn; __u8 i = 0; + __u8 *big_handle; BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); @@ -7064,16 +7078,25 @@ static void hci_le_create_big_complete_evt(struct hci_dev *hdev, void *data, rcu_read_lock(); } - if (!ev->status && !i) + rcu_read_unlock(); + + if (!ev->status && !i) { /* If no BISes have been connected for the BIG, * terminate. This is in case all bound connections * have been closed before the BIG creation * has completed. */ - hci_le_terminate_big_sync(hdev, ev->handle, - HCI_ERROR_LOCAL_HOST_TERM); + big_handle = kzalloc(sizeof(*big_handle), GFP_KERNEL); + if (!big_handle) + goto unlock; - rcu_read_unlock(); + *big_handle = ev->handle; + + hci_cmd_sync_queue(hdev, hci_iso_term_big_sync, big_handle, + hci_iso_term_big_destroy); + } + +unlock: hci_dev_unlock(hdev); } -- 2.39.2