Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8677860rwl; Tue, 10 Jan 2023 17:34:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXsB4p2/h2D1SD0H70OwWs5gQU5QFAN5L1BFSMEag9dA05ZYHze4wCEkaUkWYaBr78s2MBwo X-Received: by 2002:a17:907:cc1c:b0:84d:207d:c008 with SMTP id uo28-20020a170907cc1c00b0084d207dc008mr12402211ejc.69.1673400881467; Tue, 10 Jan 2023 17:34:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673400881; cv=none; d=google.com; s=arc-20160816; b=piBlDigf5hIUPXWin5+DmUS99pRYzybPcjKNrFxoc6eTh6oDOw96L1tdPd5T/9dV6L YKL4cO+z0tbj7mHcoCtWerpQVd/sbjdVNbyEEwwQLZn7sTKuBCimIlDniJEQP6A75jcF R1II6klWQZjViMWF+CXhWXPrMYZaWLvlooOYlUHQYxlX/Kr76Yc44UtUOnudvcf38K+q 1vr50yHeQJaOF+SYg9BPhotG6ATVfT2kolj72bH6uncmm6b+ET5IEgQW+AXyPr8TjZ88 FaPZCU2dYJFOWaxK+9hZmW6w8iziO3hgOFLJUtiM2nX42Z4DGQnlJWBWKEuUnRZ7kAjH LPsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=1hZyYu1D4iIf/DIUik1bt7umt7x6WYLcjANjQoC4Ukw=; b=q14NWNcs+uEOtqfIeJ3gqlmVkOb9lsG+5tFrVFZYG+bU0LPa12P95RVMWmWK94DLNz aFalAuZJsbO1Nr7EuKPrGfogo6Suul1aITbr7EMm9ebJRJRAjSdZWiI7jdvxlUHmmPCa iS8uSlgfp+LBoKoDNFi0V4hapdzralBoBOKCxCOg6axlEfKKkivQLPeBFpIicw0DOT0A J/qtZld67+8LgOAdsI4ZV/x7t6+cf1w/HgxU7ncWzuO4AvBOxYGaUZ9U+H0Eua99sd+4 GWB4RUmgIccaSa1IWom9VXcCK0QjkzBdmWAT3uxlagJDz1TnoxUy+wT0T6wPZ4wVUCpO DUJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WHNT5xsL; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u5-20020a170906654500b007c11f2411e1si10609693ejn.815.2023.01.10.17.34.08; Tue, 10 Jan 2023 17:34:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WHNT5xsL; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235063AbjAKBW7 (ORCPT + 99 others); Tue, 10 Jan 2023 20:22:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235224AbjAKBW6 (ORCPT ); Tue, 10 Jan 2023 20:22:58 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F242C19 for ; Tue, 10 Jan 2023 17:22:57 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id v13-20020a17090a6b0d00b00219c3be9830so15460012pjj.4 for ; Tue, 10 Jan 2023 17:22:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=1hZyYu1D4iIf/DIUik1bt7umt7x6WYLcjANjQoC4Ukw=; b=WHNT5xsLl203jJWfE7lkeXoDcs5HAE/soYai0gVdXHyOQygzHxIp0233WAsnEBxT/B qVNmec6TYrK6LFM/xFnK3N8UuDD7mHHGeL9IlIKrtHV9sHXaliW1kcMnWV0Eirs3+F6d ZIqL6SoGhtixBERqDBTIYJ4LkSB6WPMrqzbvcPie94pH25Mgqh3K7EYvapTp4ckV/7tj UiK7AMYUW+rlur/RP9Fy/boIQaMz3jCOJnCrSx4C6l4Q/fJEuz7PbBUMdQ0kk7UCXGLG lGiNvcWnzfgwUNxLLYD5zQbNghe27luIxtpUBa9WNg8WKHToJA5Sp4d/QPxwqT0Yqrv3 QQfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1hZyYu1D4iIf/DIUik1bt7umt7x6WYLcjANjQoC4Ukw=; b=mQPVD/RUDttRRSv4pdcz6LuH48MGaSqd+FjvKsdFSKN27Ks9GgMCPeU7nuhQFaa01+ b6gqCuZgBYD6pHfkJ8FaU5dEZN8SZ5rrr1cLbTn2ygBQTvRFZGY7ZevgB4Z3qjrcWIXY 3FKWUS3yfaFktAE68jWdmdXqyQE1W/s8cNVGerNkGtB/4UViotHpxBwDKLDHAAZ2PTux wf7pUvfrAJnNmVg3ANPla28BQxUkMItST4bAcQ2TNaKlIqGwRajfzn7PLnE5e/4rv+kB Icta7VuoR3J+IB6PH3SKnQGnwc/y/g38DPjKi2AHJz2kOJQJIt1ykSjBUVQTBKiExwMH IDPg== X-Gm-Message-State: AFqh2krrR3QTxJBbxmYNNpusUOaQnTOeyCTEsgtFjFJzLMPmO9JUOtFM PCivV2JALJVKUxyw5+f882iNXOl795o= X-Received: by 2002:a17:902:e84e:b0:189:aedf:677d with SMTP id t14-20020a170902e84e00b00189aedf677dmr1022845plg.69.1673400176377; Tue, 10 Jan 2023 17:22:56 -0800 (PST) Received: from lvondent-mobl4.. (c-71-59-129-171.hsd1.or.comcast.net. [71.59.129.171]) by smtp.gmail.com with ESMTPSA id m7-20020a170902db0700b00192b0a07891sm8784670plx.101.2023.01.10.17.22.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 17:22:55 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH] Bluetooth: hci_event: Fix Invalid wait context Date: Tue, 10 Jan 2023 17:22:53 -0800 Message-Id: <20230111012254.3724082-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This fixes the following trace caused by attempting to lock cmd_sync_work_lock while holding the rcu_read_lock: kworker/u3:2/212 is trying to lock: ffff888002600910 (&hdev->cmd_sync_work_lock){+.+.}-{3:3}, at: hci_cmd_sync_queue+0xad/0x140 other info that might help us debug this: context-{4:4} 4 locks held by kworker/u3:2/212: #0: ffff8880028c6530 ((wq_completion)hci0#2){+.+.}-{0:0}, at: process_one_work+0x4dc/0x9a0 #1: ffff888001aafde0 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_one_work+0x4dc/0x9a0 #2: ffff888002600070 (&hdev->lock){+.+.}-{3:3}, at: hci_cc_le_set_cig_params+0x64/0x4f0 #3: ffffffffa5994b00 (rcu_read_lock){....}-{1:2}, at: hci_cc_le_set_cig_params+0x2f9/0x4f0 Fixes: 26afbd826ee3 ("Bluetooth: Add initial implementation of CIS connections") Signed-off-by: Luiz Augusto von Dentz --- net/bluetooth/hci_event.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 0594af4e37ca..ad92a4be5851 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -3848,8 +3848,11 @@ static u8 hci_cc_le_set_cig_params(struct hci_dev *hdev, void *data, conn->handle, conn->link); /* Create CIS if LE is already connected */ - if (conn->link && conn->link->state == BT_CONNECTED) + if (conn->link && conn->link->state == BT_CONNECTED) { + rcu_read_unlock(); hci_le_create_cis(conn->link); + rcu_read_lock(); + } if (i == rp->num_handles) break; -- 2.37.3