OSDN Git Service

Merge android-4.4.185 (14e1196) into msm-4.4
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / net / bluetooth / hci_conn.c
index 1588d91..211c259 100644 (file)
@@ -1293,8 +1293,16 @@ auth:
                return 0;
 
 encrypt:
-       if (test_bit(HCI_CONN_ENCRYPT, &conn->flags))
+       if (test_bit(HCI_CONN_ENCRYPT, &conn->flags)) {
+               /* Ensure that the encryption key size has been read,
+                * otherwise stall the upper layer responses.
+                */
+               if (!conn->enc_key_size)
+                       return 0;
+
+               /* Nothing else needed, all requirements are met */
                return 1;
+       }
 
        hci_conn_encrypt(conn);
        return 0;