Merge tag 'v3.10.55' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / net / bluetooth / mgmt.c
index f8ecbc70293d1d0c0b82101c4378a4e9ea8be1bd..3e574540b2c2fab568c07e768f03bca4a40fbb17 100644 (file)
@@ -2205,10 +2205,10 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
                auth_type = HCI_AT_DEDICATED_BONDING_MITM;
 
        if (cp->addr.type == BDADDR_BREDR)
-               conn = hci_connect(hdev, ACL_LINK, &cp->addr.bdaddr,
+               conn = hci_connect(hdev, ACL_LINK, 0, &cp->addr.bdaddr,
                                   cp->addr.type, sec_level, auth_type);
        else
-               conn = hci_connect(hdev, LE_LINK, &cp->addr.bdaddr,
+               conn = hci_connect(hdev, LE_LINK, 0, &cp->addr.bdaddr,
                                   cp->addr.type, sec_level, auth_type);
 
        if (IS_ERR(conn)) {
@@ -2333,8 +2333,13 @@ static int user_pairing_resp(struct sock *sk, struct hci_dev *hdev,
        }
 
        if (addr->type == BDADDR_LE_PUBLIC || addr->type == BDADDR_LE_RANDOM) {
-               /* Continue with pairing via SMP */
+               /* Continue with pairing via SMP. The hdev lock must be
+                * released as SMP may try to recquire it for crypto
+                * purposes.
+                */
+               hci_dev_unlock(hdev);
                err = smp_user_confirm_reply(conn, mgmt_op, passkey);
+               hci_dev_lock(hdev);
 
                if (!err)
                        err = cmd_complete(sk, hdev->id, mgmt_op,