Bluetooth: Fix check for connected state when pairing
authorJohan Hedberg <johan.hedberg@intel.com>
Wed, 30 Jul 2014 05:35:48 +0000 (08:35 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 30 Jul 2014 17:28:41 +0000 (19:28 +0200)
Both BT_CONNECTED and BT_CONFIG state mean that we have a baseband link
available. We should therefore check for either of these when pairing
and deciding whether to call hci_conn_security() directly.

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

index 5d18efcb8467effd1db69a94760fe17df5c2c150..0b15b7618bebfd5d09b272e46658c49c79342eec 100644 (file)
@@ -3213,7 +3213,7 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
        conn->io_capability = cp->io_cap;
        cmd->user_data = conn;
 
-       if (conn->state == BT_CONNECTED &&
+       if ((conn->state == BT_CONNECTED || conn->state == BT_CONFIG) &&
            hci_conn_security(conn, sec_level, auth_type, true))
                pairing_complete(cmd, 0);