]> git.hungrycats.org Git - linux/commit
Bluetooth: Fix regression with minimum encryption key size alignment
authorMarcel Holtmann <marcel@holtmann.org>
Sat, 22 Jun 2019 13:47:01 +0000 (15:47 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 23 Sep 2019 20:11:51 +0000 (21:11 +0100)
commit251ff7c5d9ef901c652b89162a3a4c5b2546aaca
treec8fed366740a304f142e0ad2bed5175167a287bd
parent1f52c0fb870d0a3e00f790d5a8085bcb234ad0fe
Bluetooth: Fix regression with minimum encryption key size alignment

commit 693cd8ce3f882524a5d06f7800dd8492411877b3 upstream.

When trying to align the minimum encryption key size requirement for
Bluetooth connections, it turns out doing this in a central location in
the HCI connection handling code is not possible.

Original Bluetooth version up to 2.0 used a security model where the
L2CAP service would enforce authentication and encryption.  Starting
with Bluetooth 2.1 and Secure Simple Pairing that model has changed into
that the connection initiator is responsible for providing an encrypted
ACL link before any L2CAP communication can happen.

Now connecting Bluetooth 2.1 or later devices with Bluetooth 2.0 and
before devices are causing a regression.  The encryption key size check
needs to be moved out of the HCI connection handling into the L2CAP
channel setup.

To achieve this, the current check inside hci_conn_security() has been
moved into l2cap_check_enc_key_size() helper function and then called
from four decisions point inside L2CAP to cover all combinations of
Secure Simple Pairing enabled devices and device using legacy pairing
and legacy service security model.

Fixes: d5bb334a8e17 ("Bluetooth: Align minimum encryption key size for LE and BR/EDR connections")
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203643
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[bwh: Backported to 3.16:
 - Encryption flag is in hci_conn::link_mode not hci_conn::flags
 - Adjust context, indentation]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/bluetooth/hci_conn.c
net/bluetooth/l2cap_core.c