Skip to contentSkip to conversation

Bluetooth: Fix wrong New Settings event when closing HCI User Channel

PATCH Applied Marcel Holtmann 2 participants 2 messages Sep 4, 2016 – Sep 6, 2016

Subsystems (2)
lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: Fix wrong New Settings event when closing HCI User Channel

When closing HCI User Channel, the New Settings event was send out to inform about changed settings. However such event is wrong since the exclusive HCI User Channel access is active until the Index Added event has been sent.

@ USER Close: test
@ MGMT Event: New Settings (0x0006) plen 4
Current settings: 0x00000ad0
Bondable
Secure Simple Pairing
BR/EDR
Low Energy
Secure Connections
= Close Index: 00:14:EF:22:04:12
@ MGMT Event: Index Added (0x0004) plen 0

Calling __mgmt_power_off from hci_dev_do_close requires an extra check for an active HCI User Channel.

---
 net/bluetooth/hci_core.c | 1 +
 1 file changed, 1 insertion(+)
net/bluetooth/hci_core.c +1 -0
index ddf8432fe8fb..3ac89e9ace71 100644
@@ -1562,6 +1562,7 @@ int hci_dev_do_close(struct hci_dev *hdev)
 	auto_off = hci_dev_test_and_clear_flag(hdev, HCI_AUTO_OFF);
 
 	if (!auto_off && hdev->dev_type == HCI_PRIMARY &&
+	    !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) &&
 	    hci_dev_test_flag(hdev, HCI_MGMT))
 		__mgmt_power_off(hdev);
 
Signature · 1 line
2.7.4
#1 lore raw

Hi Marcel,

Quoted 16 lines · Marcel Holtmann

When closing HCI User Channel, the New Settings event was send out to inform about changed settings. However such event is wrong since the exclusive HCI User Channel access is active until the Index Added event has been sent.

@ USER Close: test
@ MGMT Event: New Settings (0x0006) plen 4
Current settings: 0x00000ad0
Bondable
Secure Simple Pairing
BR/EDR
Low Energy
Secure Connections
= Close Index: 00:14:EF:22:04:12
@ MGMT Event: Index Added (0x0004) plen 0

Quoted 7 lines

Calling __mgmt_power_off from hci_dev_do_close requires an extra check for an active HCI User Channel.

---
 net/bluetooth/hci_core.c | 1 +
 1 file changed, 1 insertion(+)

Applied to bluetooth-next. Thanks.

Johan