[SRU][Noble] Bluetooth: hci_sync: fix HCI_CMD_DRAIN_WORKQUEUE fix

Krzysztof Adamski krzysztof.adamski at canonical.com
Wed Sep 23 07:44:17 UTC 2026


BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2167919

The commit fd719dc6e35c ("Bluetooth: hci_sync: Set
HCI_CMD_DRAIN_WORKQUEUE during device close") introduced a regression
that breaks hci_cmd_timeout(). This was disovered on the Ventuno Q
platform, where this prevents the QCA2066 Bluetooth card from probing,
as its initialization relies on a timeout-triggered reset.

The regression was caused by an incorrect rebase of upstream commit
47330cc875b3 with the same name. The original change intended to set the
HCI_CMD_DRAIN_WORKQUEUE flag only during hci_dev_close_sync() and clear
it before completion. Instead, the flag was mistakenly added to
hci_dev_open_sync() at rebase.

As a result, command timeout handling was permanently cancelled upon
device bring-up rather than temporarily during device closure. Fix this
by moving the flag handling to hci_dev_close_sync().

Signed-off-by: Krzysztof Adamski <krzysztof.adamski at canonical.com>
---
 net/bluetooth/hci_sync.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 88675037f21f..5f60b95390e2 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -5049,12 +5049,6 @@ int hci_dev_open_sync(struct hci_dev *hdev)
 
 	bt_dev_dbg(hdev, "");
 
-	/* Set HCI_DRAIN_WORKQUEUE flag to prevent queuing work during
-	 * reset/close. See hci_cmd_work() and handle_cmd_cnt_and_timer().
-	 */
-	hci_dev_set_flag(hdev, HCI_CMD_DRAIN_WORKQUEUE);
-	synchronize_rcu();
-
 	if (hci_dev_test_flag(hdev, HCI_UNREGISTER)) {
 		ret = -ENODEV;
 		goto done;
@@ -5206,6 +5200,12 @@ int hci_dev_close_sync(struct hci_dev *hdev)
 
 	bt_dev_dbg(hdev, "");
 
+	/* Set HCI_DRAIN_WORKQUEUE flag to prevent queuing work during
+	 * reset/close. See hci_cmd_work() and handle_cmd_cnt_and_timer().
+	 */
+	hci_dev_set_flag(hdev, HCI_CMD_DRAIN_WORKQUEUE);
+	synchronize_rcu();
+
 	cancel_delayed_work(&hdev->power_off);
 	cancel_delayed_work(&hdev->ncmd_timer);
 	cancel_delayed_work(&hdev->le_scan_disable);
-- 
2.53.0




More information about the kernel-team mailing list