diff mbox series

[v1] Bluetooth: hci_sync: Establishing ACL links is prohibited when power off

Message ID 20250408024646.1784057-1-quic_shuaz@quicinc.com
State New
Headers show
Series [v1] Bluetooth: hci_sync: Establishing ACL links is prohibited when power off | expand

Commit Message

Shuai Zhang April 8, 2025, 2:46 a.m. UTC
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(-)

--
2.34.1
diff mbox series

Patch

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