diff options
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r-- | net/bluetooth/mgmt.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 53e109eb043e..1ce8d80ce38d 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -1347,6 +1347,7 @@ static int pair_device(struct sock *sk, u16 index, unsigned char *data, u16 len) | |||
1347 | struct hci_dev *hdev; | 1347 | struct hci_dev *hdev; |
1348 | struct mgmt_cp_pair_device *cp; | 1348 | struct mgmt_cp_pair_device *cp; |
1349 | struct pending_cmd *cmd; | 1349 | struct pending_cmd *cmd; |
1350 | struct adv_entry *entry; | ||
1350 | u8 sec_level, auth_type; | 1351 | u8 sec_level, auth_type; |
1351 | struct hci_conn *conn; | 1352 | struct hci_conn *conn; |
1352 | int err; | 1353 | int err; |
@@ -1372,7 +1373,14 @@ static int pair_device(struct sock *sk, u16 index, unsigned char *data, u16 len) | |||
1372 | auth_type = HCI_AT_DEDICATED_BONDING_MITM; | 1373 | auth_type = HCI_AT_DEDICATED_BONDING_MITM; |
1373 | } | 1374 | } |
1374 | 1375 | ||
1375 | conn = hci_connect(hdev, ACL_LINK, &cp->bdaddr, sec_level, auth_type); | 1376 | entry = hci_find_adv_entry(hdev, &cp->bdaddr); |
1377 | if (entry) | ||
1378 | conn = hci_connect(hdev, LE_LINK, &cp->bdaddr, sec_level, | ||
1379 | auth_type); | ||
1380 | else | ||
1381 | conn = hci_connect(hdev, ACL_LINK, &cp->bdaddr, sec_level, | ||
1382 | auth_type); | ||
1383 | |||
1376 | if (IS_ERR(conn)) { | 1384 | if (IS_ERR(conn)) { |
1377 | err = PTR_ERR(conn); | 1385 | err = PTR_ERR(conn); |
1378 | goto unlock; | 1386 | goto unlock; |
@@ -1391,7 +1399,10 @@ static int pair_device(struct sock *sk, u16 index, unsigned char *data, u16 len) | |||
1391 | goto unlock; | 1399 | goto unlock; |
1392 | } | 1400 | } |
1393 | 1401 | ||
1394 | conn->connect_cfm_cb = pairing_complete_cb; | 1402 | /* For LE, just connecting isn't a proof that the pairing finished */ |
1403 | if (!entry) | ||
1404 | conn->connect_cfm_cb = pairing_complete_cb; | ||
1405 | |||
1395 | conn->security_cfm_cb = pairing_complete_cb; | 1406 | conn->security_cfm_cb = pairing_complete_cb; |
1396 | conn->disconn_cfm_cb = pairing_complete_cb; | 1407 | conn->disconn_cfm_cb = pairing_complete_cb; |
1397 | conn->io_capability = cp->io_cap; | 1408 | conn->io_capability = cp->io_cap; |