Skip to contentSkip to conversation

Bluetooth: Fix link security setting when powering on

PATCH In review Johan Hedberg 3 participants 5 messages Jan 27, 2013 – Jan 28, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 Bluetooth: Fix link security setting when powering on

From: Johan Hedberg <[email protected]>

If a controller is powered on while the HCI_AUTO_OFF flag is set the link security setting (HCI_LINK_SECURITY) might not be in sync with the actual state of the controller (HCI_AUTH). This patch fixes the issue by checking for inequality between the intended and actual settings and sends a HCI_Write_Auth_Enable command if necessary.

---
 net/bluetooth/mgmt.c |    7 +++++++
 1 file changed, 7 insertions(+)
net/bluetooth/mgmt.c +7 -0
index fbc8edf..ae7585d 100644
@@ -3073,6 +3073,8 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
 	mgmt_pending_foreach(MGMT_OP_SET_POWERED, hdev, settings_rsp, &match);
 
 	if (powered) {
+		u8 link_sec;
+
 		if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags) &&
 		    !lmp_host_ssp_capable(hdev)) {
 			u8 ssp = 1;
@@ -3096,6 +3098,11 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
 					     sizeof(cp), &cp);
 		}
 
+		link_sec = test_bit(HCI_LINK_SECURITY, &hdev->dev_flags);
+		if (link_sec != test_bit(HCI_AUTH, &hdev->flags))
+			hci_send_cmd(hdev, HCI_OP_WRITE_AUTH_ENABLE,
+				     sizeof(link_sec), &link_sec);
+
 		if (lmp_bredr_capable(hdev)) {
 			set_bredr_scan(hdev);
 			update_class(hdev);
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v2 2/2 Bluetooth: Increment Management interface revision

From: Johan Hedberg <[email protected]>

This patch increments the management interface revision due to the various fixes, improvements and other changes that have gone in lately.

---
 net/bluetooth/mgmt.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/mgmt.c +1 -1
index ae7585d..3bd4c41 100644
@@ -35,7 +35,7 @@
 bool enable_hs;
 
 #define MGMT_VERSION	1
-#define MGMT_REVISION	2
+#define MGMT_REVISION	3
 
 static const u16 mgmt_commands[] = {
 	MGMT_OP_READ_INDEX_LIST,
Signature · 1 line
1.7.10.4
maintainer Acked-by on v2 2/2
#2 lore raw

Re: [PATCH 2/2 v2] Bluetooth: Increment Management interface revision

Hi Johan,

Quoted 7 lines

This patch increments the management interface revision due to the various fixes, improvements and other changes that have gone in lately.

---
 net/bluetooth/mgmt.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Regards

Marcel

#3 lore raw

Re: [PATCH 2/2 v2] Bluetooth: Increment Management interface revision

In reply to Johan Hedberg

Hi Johan,

Quoted 9 lines · Johan Hedberg

From: Johan Hedberg <[email protected]>

This patch increments the management interface revision due to the various fixes, improvements and other changes that have gone in lately.

---
 net/bluetooth/mgmt.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Both patches have been applied to bluetooth-next. Thanks.

Gustavo

maintainer Acked-by on v2 1/2
#4 lore raw
In reply to Johan Hedberg

Hi Johan,

Quoted 10 lines

If a controller is powered on while the HCI_AUTO_OFF flag is set the link security setting (HCI_LINK_SECURITY) might not be in sync with the actual state of the controller (HCI_AUTH). This patch fixes the issue by checking for inequality between the intended and actual settings and sends a HCI_Write_Auth_Enable command if necessary.

---
 net/bluetooth/mgmt.c |    7 +++++++
 1 file changed, 7 insertions(+)

Regards

Marcel