aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_event.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-07-17 08:35:40 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-07-17 08:39:40 -0400
commit2f407f0afb443207789df3fb46456551aea11cc3 (patch)
tree692c42de376c055b39ae50c49fc990603ad350fb /net/bluetooth/hci_event.c
parent977f8fce0279e5f96dc5c5068610d60b9ae94802 (diff)
Bluetooth: Fix allowing initiating pairing when not pairable
When we're not pairable we should still allow us to act as initiators for pairing, i.e. the HCI_PAIRABLE flag should only be affecting incoming pairing attempts. This patch fixes the relevant checks for the hci_io_capa_request_evt() and hci_pin_code_request_evt() functions. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r--net/bluetooth/hci_event.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index af2cdca03d73..4c41774aa556 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3118,10 +3118,11 @@ static void hci_pin_code_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
3118 hci_conn_drop(conn); 3118 hci_conn_drop(conn);
3119 } 3119 }
3120 3120
3121 if (!test_bit(HCI_PAIRABLE, &hdev->dev_flags)) 3121 if (!test_bit(HCI_PAIRABLE, &hdev->dev_flags) &&
3122 !test_bit(HCI_CONN_AUTH_INITIATOR, &conn->flags)) {
3122 hci_send_cmd(hdev, HCI_OP_PIN_CODE_NEG_REPLY, 3123 hci_send_cmd(hdev, HCI_OP_PIN_CODE_NEG_REPLY,
3123 sizeof(ev->bdaddr), &ev->bdaddr); 3124 sizeof(ev->bdaddr), &ev->bdaddr);
3124 else if (test_bit(HCI_MGMT, &hdev->dev_flags)) { 3125 } else if (test_bit(HCI_MGMT, &hdev->dev_flags)) {
3125 u8 secure; 3126 u8 secure;
3126 3127
3127 if (conn->pending_sec_level == BT_SECURITY_HIGH) 3128 if (conn->pending_sec_level == BT_SECURITY_HIGH)
@@ -3647,7 +3648,11 @@ static void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
3647 if (!test_bit(HCI_MGMT, &hdev->dev_flags)) 3648 if (!test_bit(HCI_MGMT, &hdev->dev_flags))
3648 goto unlock; 3649 goto unlock;
3649 3650
3651 /* Allow pairing if we're pairable, the initiators of the
3652 * pairing or if the remote is not requesting bonding.
3653 */
3650 if (test_bit(HCI_PAIRABLE, &hdev->dev_flags) || 3654 if (test_bit(HCI_PAIRABLE, &hdev->dev_flags) ||
3655 test_bit(HCI_CONN_AUTH_INITIATOR, &conn->flags) ||
3651 (conn->remote_auth & ~0x01) == HCI_AT_NO_BONDING) { 3656 (conn->remote_auth & ~0x01) == HCI_AT_NO_BONDING) {
3652 struct hci_cp_io_capability_reply cp; 3657 struct hci_cp_io_capability_reply cp;
3653 3658