aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-09-08 20:09:49 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-09-08 21:12:15 -0400
commite1e930f591bfd9604c3077f0af5c390f4f890259 (patch)
tree6a336f7ddb09a2e53150907656207088afb24b0e /net/bluetooth/mgmt.c
parentc68b7f127d5f517c214e8bcf231d0188f6776d2a (diff)
Bluetooth: Fix mgmt pairing failure when authentication fails
Whether through HCI with BR/EDR or SMP with LE when authentication fails we should also notify any pending Pair Device mgmt command. This patch updates the mgmt_auth_failed function to take the actual hci_conn object and makes sure that any pending pairing command is notified and cleaned up appropriately. 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.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index ab9521ae3c63..efb71b022ab6 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -6485,16 +6485,23 @@ int mgmt_user_passkey_notify(struct hci_dev *hdev, bdaddr_t *bdaddr,
6485 return mgmt_event(MGMT_EV_PASSKEY_NOTIFY, hdev, &ev, sizeof(ev), NULL); 6485 return mgmt_event(MGMT_EV_PASSKEY_NOTIFY, hdev, &ev, sizeof(ev), NULL);
6486} 6486}
6487 6487
6488void mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 6488void mgmt_auth_failed(struct hci_conn *conn, u8 hci_status)
6489 u8 addr_type, u8 status)
6490{ 6489{
6491 struct mgmt_ev_auth_failed ev; 6490 struct mgmt_ev_auth_failed ev;
6491 struct pending_cmd *cmd;
6492 u8 status = mgmt_status(hci_status);
6492 6493
6493 bacpy(&ev.addr.bdaddr, bdaddr); 6494 bacpy(&ev.addr.bdaddr, &conn->dst);
6494 ev.addr.type = link_to_bdaddr(link_type, addr_type); 6495 ev.addr.type = link_to_bdaddr(conn->type, conn->dst_type);
6495 ev.status = mgmt_status(status); 6496 ev.status = status;
6496 6497
6497 mgmt_event(MGMT_EV_AUTH_FAILED, hdev, &ev, sizeof(ev), NULL); 6498 cmd = find_pairing(conn);
6499
6500 mgmt_event(MGMT_EV_AUTH_FAILED, conn->hdev, &ev, sizeof(ev),
6501 cmd ? cmd->sk : NULL);
6502
6503 if (cmd)
6504 pairing_complete(cmd, status);
6498} 6505}
6499 6506
6500void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status) 6507void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status)