public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] Bluetooth: hci_sync: Establishing ACL links is prohibited when power off
@ 2025-04-08  2:46 Shuai Zhang
  2025-04-08  3:48 ` [v1] " bluez.test.bot
  2025-04-08  9:37 ` [PATCH v1] " Paul Menzel
  0 siblings, 2 replies; 4+ messages in thread
From: Shuai Zhang @ 2025-04-08  2:46 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: quic_shuaz, quic_chejiang, quic_jiaymao, quic_chezhou,
	quic_zijuhu, quic_mohamull

If turning off BT during pairing, "hci_acl_create_conn_sync" has chances
to be left in cmd_sync_work_list. Then the driver will try to send
the HCI command of creating connection but failed.

When establishing ACL link, add judgment for BT power off.

Change-Id: I9844a1ce1f207453e4fadeded3da1738eb4660c9
Signed-off-by: Shuai Zhang <quic_shuaz@quicinc.com>
---
 net/bluetooth/hci_sync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index aeeadb45e..fdd57132e 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -6761,7 +6761,7 @@ static int hci_acl_create_conn_sync(struct hci_dev *hdev, void *data)
 	struct hci_cp_create_conn cp;
 	int err;

-	if (!hci_conn_valid(hdev, conn))
+	if (!hci_conn_valid(hdev, conn) || !test_bit(HCI_UP, &hdev->flags))
 		return -ECANCELED;

 	/* Many controllers disallow HCI Create Connection while it is doing
--
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-04-08 10:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-08  2:46 [PATCH v1] Bluetooth: hci_sync: Establishing ACL links is prohibited when power off Shuai Zhang
2025-04-08  3:48 ` [v1] " bluez.test.bot
2025-04-08  9:37 ` [PATCH v1] " Paul Menzel
2025-04-08 10:00   ` Shuai Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox