Skip to content

Commit 71f78c6

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 <marcel@holtmann.org> Cc: stable@vger.kernel.org
1 parent 997a812 commit 71f78c6

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎net/bluetooth/hci_conn.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,8 +1275,13 @@ int hci_conn_check_link_mode(struct hci_conn *conn)
12751275
return 0;
12761276
}
12771277

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

12821287
return 1;

0 commit comments

Comments
 (0)