]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/bluetooth/hci_conn.c
Merge tag 'rtc-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux
[linux.git] / net / bluetooth / hci_conn.c
index bd4978ce8c45330219e823fad140b7b586622c92..3cf0764d5793f42c55b39caf79a7e15734fbc40d 100644 (file)
@@ -1276,6 +1276,14 @@ int hci_conn_check_link_mode(struct hci_conn *conn)
            !test_bit(HCI_CONN_ENCRYPT, &conn->flags))
                return 0;
 
+       /* The minimum encryption key size needs to be enforced by the
+        * host stack before establishing any L2CAP connections. The
+        * specification in theory allows a minimum of 1, but to align
+        * BR/EDR and LE transports, a minimum of 7 is chosen.
+        */
+       if (conn->enc_key_size < HCI_MIN_ENC_KEY_SIZE)
+               return 0;
+
        return 1;
 }