Bluetooth: Update pending_sec_level on auth update.
Based on the user requirement for auth type, update even
the pending security level. This will make sure the authentication
requirement matches the action at kernel space on connection
establishment.
CRs-Fixed: 385463
Change-Id: I94c7e621c105bb2180e6e722cc8cca17869ff2e5
Signed-off-by: Srinivas Krovvidi <skrovvid@codeaurora.org>
Signed-off-by: Mallikarjuna GB <gbmalli@codeaurora.org>
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 879c68b..47d3f16 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -1401,8 +1401,24 @@
hci_dev_lock_bh(hdev);
conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &req.bdaddr);
- if (conn)
+ if (conn) {
conn->auth_type = req.type;
+ switch (conn->auth_type) {
+ case HCI_AT_NO_BONDING:
+ conn->pending_sec_level = BT_SECURITY_LOW;
+ break;
+ case HCI_AT_DEDICATED_BONDING:
+ case HCI_AT_GENERAL_BONDING:
+ conn->pending_sec_level = BT_SECURITY_MEDIUM;
+ break;
+ case HCI_AT_DEDICATED_BONDING_MITM:
+ case HCI_AT_GENERAL_BONDING_MITM:
+ conn->pending_sec_level = BT_SECURITY_HIGH;
+ break;
+ default:
+ break;
+ }
+ }
hci_dev_unlock_bh(hdev);
if (!conn)