diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2011-04-28 14:28:55 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-04-28 15:03:20 -0400 |
commit | 79c6c70cbe35c270e7b59207ab76b44183a1030a (patch) | |
tree | 9c2656b3670e7c54a967ce37a3e6ac6e0060d055 /net/bluetooth/hci_event.c | |
parent | 9f61656a60c9506e3e4cd41af5efbcf6a30ee3b9 (diff) |
Bluetooth: Fix HCI_CONN_AUTH_PEND flag for all authentication requests
The HCI_CONN_AUTH_PEND flag should be set whenever requesting
authentication so that multiple pending requests can't occur.
Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r-- | net/bluetooth/hci_event.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index a479389668ef..ce8e09955834 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -1021,12 +1021,19 @@ static void hci_cs_remote_name_req(struct hci_dev *hdev, __u8 status) | |||
1021 | hci_dev_lock(hdev); | 1021 | hci_dev_lock(hdev); |
1022 | 1022 | ||
1023 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); | 1023 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr); |
1024 | if (conn && hci_outgoing_auth_needed(hdev, conn)) { | 1024 | if (!conn) |
1025 | goto unlock; | ||
1026 | |||
1027 | if (!hci_outgoing_auth_needed(hdev, conn)) | ||
1028 | goto unlock; | ||
1029 | |||
1030 | if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) { | ||
1025 | struct hci_cp_auth_requested cp; | 1031 | struct hci_cp_auth_requested cp; |
1026 | cp.handle = __cpu_to_le16(conn->handle); | 1032 | cp.handle = __cpu_to_le16(conn->handle); |
1027 | hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp); | 1033 | hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp); |
1028 | } | 1034 | } |
1029 | 1035 | ||
1036 | unlock: | ||
1030 | hci_dev_unlock(hdev); | 1037 | hci_dev_unlock(hdev); |
1031 | } | 1038 | } |
1032 | 1039 | ||
@@ -1516,12 +1523,19 @@ static inline void hci_remote_name_evt(struct hci_dev *hdev, struct sk_buff *skb | |||
1516 | mgmt_remote_name(hdev->id, &ev->bdaddr, ev->name); | 1523 | mgmt_remote_name(hdev->id, &ev->bdaddr, ev->name); |
1517 | 1524 | ||
1518 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); | 1525 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); |
1519 | if (conn && hci_outgoing_auth_needed(hdev, conn)) { | 1526 | if (!conn) |
1527 | goto unlock; | ||
1528 | |||
1529 | if (!hci_outgoing_auth_needed(hdev, conn)) | ||
1530 | goto unlock; | ||
1531 | |||
1532 | if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) { | ||
1520 | struct hci_cp_auth_requested cp; | 1533 | struct hci_cp_auth_requested cp; |
1521 | cp.handle = __cpu_to_le16(conn->handle); | 1534 | cp.handle = __cpu_to_le16(conn->handle); |
1522 | hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp); | 1535 | hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp); |
1523 | } | 1536 | } |
1524 | 1537 | ||
1538 | unlock: | ||
1525 | hci_dev_unlock(hdev); | 1539 | hci_dev_unlock(hdev); |
1526 | } | 1540 | } |
1527 | 1541 | ||