1 From 83f0a8986ae42e33bc16acda0451dce2cf4dfb55 Mon Sep 17 00:00:00 2001
2 From: Marcel Holtmann <marcel@holtmann.org>
3 Date: Wed, 22 May 2019 09:05:40 +0200
4 Subject: [PATCH] Bluetooth: Check key sizes only when Secure Simple
7 The encryption is only mandatory to be enforced when both sides are using
8 Secure Simple Pairing and this means the key size check makes only sense
11 On legacy Bluetooth 2.0 and earlier devices like mice the encryption was
12 optional and thus causing an issue if the key size check is not bound to
13 using Secure Simple Pairing.
15 Fixes: d5bb334a8e17 ("Bluetooth: Align minimum encryption key size for LE and BR/EDR connections")
16 Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
17 Cc: stable@vger.kernel.org
19 net/bluetooth/hci_conn.c | 9 +++++++--
20 1 file changed, 7 insertions(+), 2 deletions(-)
22 --- a/net/bluetooth/hci_conn.c
23 +++ b/net/bluetooth/hci_conn.c
24 @@ -1282,8 +1282,13 @@ int hci_conn_check_link_mode(struct hci_
28 - if (hci_conn_ssp_enabled(conn) &&
29 - !test_bit(HCI_CONN_ENCRYPT, &conn->flags))
30 + /* If Secure Simple Pairing is not enabled, then legacy connection
31 + * setup is used and no encryption or key sizes can be enforced.
33 + if (!hci_conn_ssp_enabled(conn))
36 + if (!test_bit(HCI_CONN_ENCRYPT, &conn->flags))