Skip to content

Commit 31c2a3e

Browse files
holtmannpopcornmix
authored andcommitted
Bluetooth: Check key sizes only when Secure Simple Pairing is enabled
The encryption is only mandatory to be enforced when both sides are using Secure Simple Pairing and this means the key size check makes only sense in that case. On legacy Bluetooth 2.0 and earlier devices like mice the encryption was optional and thus causing an issue if the key size check is not bound to using Secure Simple Pairing. Fixes: d5bb334 ("Bluetooth: Align minimum encryption key size for LE and BR/EDR connections") Signed-off-by: Marcel Holtmann <[email protected]> Cc: [email protected]
1 parent f26671a commit 31c2a3e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

net/bluetooth/hci_conn.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,8 +1272,13 @@ int hci_conn_check_link_mode(struct hci_conn *conn)
12721272
return 0;
12731273
}
12741274

1275-
if (hci_conn_ssp_enabled(conn) &&
1276-
!test_bit(HCI_CONN_ENCRYPT, &conn->flags))
1275+
/* If Secure Simple Pairing is not enabled, then legacy connection
1276+
* setup is used and no encryption or key sizes can be enforced.
1277+
*/
1278+
if (!hci_conn_ssp_enabled(conn))
1279+
return 1;
1280+
1281+
if (!test_bit(HCI_CONN_ENCRYPT, &conn->flags))
12771282
return 0;
12781283

12791284
return 1;

0 commit comments

Comments
 (0)