From 713c73f5a5b097658746be0e5834f0b2b272d88b Mon Sep 17 00:00:00 2001 From: Brian Gix Date: Wed, 16 Nov 2011 13:53:14 -0800 Subject: [PATCH] --- yaml --- r: 278586 b: refs/heads/master c: 47c15e2b332dd51048170915ad8c4ab4b47e3bf2 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/net/bluetooth/mgmt.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 6fd2137891ec..a84c4b877698 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0df4c185ed84d914fa2671fa5f4cec2f8dee2d2e +refs/heads/master: 47c15e2b332dd51048170915ad8c4ab4b47e3bf2 diff --git a/trunk/net/bluetooth/mgmt.c b/trunk/net/bluetooth/mgmt.c index 394222ef67ac..c06a05c09a95 100644 --- a/trunk/net/bluetooth/mgmt.c +++ b/trunk/net/bluetooth/mgmt.c @@ -1587,6 +1587,30 @@ static int user_pairing_resp(struct sock *sk, u16 index, bdaddr_t *bdaddr, goto done; } + /* + * Check for an existing ACL link, if present pair via + * HCI commands. + * + * If no ACL link is present, check for an LE link and if + * present, pair via the SMP engine. + * + * If neither ACL nor LE links are present, fail with error. + */ + conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, bdaddr); + if (!conn) { + conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, bdaddr); + if (!conn) { + err = cmd_status(sk, index, mgmt_op, + MGMT_STATUS_NOT_CONNECTED); + goto done; + } + + /* Continue with pairing via SMP */ + + err = cmd_status(sk, index, mgmt_op, MGMT_STATUS_SUCCESS); + goto done; + } + cmd = mgmt_pending_add(sk, mgmt_op, hdev, bdaddr, sizeof(*bdaddr)); if (!cmd) { err = -ENOMEM;