Bluetooth: Fix completing SMP as peripheral when no keys are expected
authorJohan Hedberg <johan.hedberg@intel.com>
Tue, 18 Feb 2014 15:14:34 +0000 (17:14 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 18 Feb 2014 16:58:20 +0000 (08:58 -0800)
When we're the acceptors (peripheral/slave) of an SMP procedure and
we've completed distributing our keys we should only stick around
waiting for keys from the remote side if any of the initiator
distribution bits were actually set. This patch fixes the
smp_distribute_keys function to clear the SMP context when this
situation occurs.

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

index 5867c1c3f4367253386691482286a1c21b074ae6..0c0dd1b52b66dea23abb90883565d0326564e214 100644 (file)
@@ -1175,7 +1175,7 @@ int smp_distribute_keys(struct l2cap_conn *conn, __u8 force)
                *keydist &= ~SMP_DIST_SIGN;
        }
 
-       if (conn->hcon->out || force) {
+       if (conn->hcon->out || force || !(rsp->init_key_dist & 0x07)) {
                clear_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags);
                cancel_delayed_work_sync(&conn->security_timer);
                smp_chan_destroy(conn);