aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2015-10-21 11:03:01 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-10-21 12:38:22 -0400
commit9d4c1cc15b14b4a96ddfcfac533a12f9f527c129 (patch)
tree62aa03d25ea1af75017bd23e85c25327bf7d83aa /net/bluetooth/mgmt.c
parent1b51c7b6e878a2df6fdb5bcf51f966eb46a330e0 (diff)
Bluetooth: Use hci_conn_hash_lookup_le() when possible
Use the new hci_conn_hash_lookup_le() API to look up LE connections. This way we're guaranteed exact matches that also take into account the address type. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index de338d576907..19834f524a7b 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3098,8 +3098,8 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data,
3098 } else { 3098 } else {
3099 u8 addr_type = le_addr_type(cp->addr.type); 3099 u8 addr_type = le_addr_type(cp->addr.type);
3100 3100
3101 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, 3101 conn = hci_conn_hash_lookup_le(hdev, &cp->addr.bdaddr,
3102 &cp->addr.bdaddr); 3102 addr_type);
3103 if (conn) { 3103 if (conn) {
3104 /* Defer clearing up the connection parameters 3104 /* Defer clearing up the connection parameters
3105 * until closing to give a chance of keeping 3105 * until closing to give a chance of keeping
@@ -3198,7 +3198,8 @@ static int disconnect(struct sock *sk, struct hci_dev *hdev, void *data,
3198 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, 3198 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK,
3199 &cp->addr.bdaddr); 3199 &cp->addr.bdaddr);
3200 else 3200 else
3201 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->addr.bdaddr); 3201 conn = hci_conn_hash_lookup_le(hdev, &cp->addr.bdaddr,
3202 le_addr_type(cp->addr.type));
3202 3203
3203 if (!conn || conn->state == BT_OPEN || conn->state == BT_CLOSED) { 3204 if (!conn || conn->state == BT_OPEN || conn->state == BT_CLOSED) {
3204 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_DISCONNECT, 3205 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_DISCONNECT,
@@ -3695,7 +3696,8 @@ static int user_pairing_resp(struct sock *sk, struct hci_dev *hdev,
3695 if (addr->type == BDADDR_BREDR) 3696 if (addr->type == BDADDR_BREDR)
3696 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &addr->bdaddr); 3697 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &addr->bdaddr);
3697 else 3698 else
3698 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &addr->bdaddr); 3699 conn = hci_conn_hash_lookup_le(hdev, &addr->bdaddr,
3700 le_addr_type(addr->type));
3699 3701
3700 if (!conn) { 3702 if (!conn) {
3701 err = mgmt_cmd_complete(sk, hdev->id, mgmt_op, 3703 err = mgmt_cmd_complete(sk, hdev->id, mgmt_op,