diff options
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/l2cap.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index d563f2ebcbb3..79a4325a1388 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -268,16 +268,26 @@ static inline int l2cap_check_security(struct sock *sk) | |||
268 | struct l2cap_conn *conn = l2cap_pi(sk)->conn; | 268 | struct l2cap_conn *conn = l2cap_pi(sk)->conn; |
269 | __u8 auth_type; | 269 | __u8 auth_type; |
270 | 270 | ||
271 | switch (l2cap_pi(sk)->sec_level) { | 271 | if (l2cap_pi(sk)->psm == cpu_to_le16(0x0001)) { |
272 | case BT_SECURITY_HIGH: | 272 | if (l2cap_pi(sk)->sec_level == BT_SECURITY_HIGH) |
273 | auth_type = HCI_AT_GENERAL_BONDING_MITM; | 273 | auth_type = HCI_AT_NO_BONDING_MITM; |
274 | break; | 274 | else |
275 | case BT_SECURITY_MEDIUM: | 275 | auth_type = HCI_AT_NO_BONDING; |
276 | auth_type = HCI_AT_GENERAL_BONDING; | 276 | |
277 | break; | 277 | if (l2cap_pi(sk)->sec_level == BT_SECURITY_LOW) |
278 | default: | 278 | l2cap_pi(sk)->sec_level = BT_SECURITY_SDP; |
279 | auth_type = HCI_AT_NO_BONDING; | 279 | } else { |
280 | break; | 280 | switch (l2cap_pi(sk)->sec_level) { |
281 | case BT_SECURITY_HIGH: | ||
282 | auth_type = HCI_AT_GENERAL_BONDING_MITM; | ||
283 | break; | ||
284 | case BT_SECURITY_MEDIUM: | ||
285 | auth_type = HCI_AT_GENERAL_BONDING; | ||
286 | break; | ||
287 | default: | ||
288 | auth_type = HCI_AT_NO_BONDING; | ||
289 | break; | ||
290 | } | ||
281 | } | 291 | } |
282 | 292 | ||
283 | return hci_conn_security(conn->hcon, l2cap_pi(sk)->sec_level, | 293 | return hci_conn_security(conn->hcon, l2cap_pi(sk)->sec_level, |