Bluetooth: Don't try to confirm locally initiated SMP pairing
authorJohan Hedberg <johan.hedberg@intel.com>
Mon, 24 Mar 2014 12:39:07 +0000 (14:39 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 24 Mar 2014 14:51:56 +0000 (07:51 -0700)
In the case that the just-works model would be triggered we only want to
confirm remotely initiated pairings (i.e. those triggered by a Security
Request or Pairing Request). This patch adds the necessary check to the
tk_request function to fall back to the JUST_WORKS method in the case of
a locally initiated pairing.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/smp.c

index 1b28f5fd798ffbb8002a3f4c89c6acd451aa5c50..b952041bf4ac7e74908fe3716a475d44a8a7389a 100644 (file)
@@ -387,6 +387,11 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth,
        if (!(auth & SMP_AUTH_BONDING) && method == JUST_CFM)
                method = JUST_WORKS;
 
+       /* Don't confirm locally initiated pairing attempts */
+       if (method == JUST_CFM && test_bit(SMP_FLAG_INITIATOR,
+                                          &smp->smp_flags))
+               method = JUST_WORKS;
+
        /* If Just Works, Continue with Zero TK */
        if (method == JUST_WORKS) {
                set_bit(SMP_FLAG_TK_VALID, &smp->smp_flags);