diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-03-20 12:54:16 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-03-20 09:14:26 -0700 |
commit | 61b1a7fbda6f761ebe16a62124578ca0779d9365 (patch) | |
tree | adbfc3fa3d25de3172044fff69a0ff50cedc146d /net/bluetooth/smp.c | |
parent | 39adbffe4b16285c54016d3e64471396354ae49f (diff) | |
download | linux-stable-61b1a7fbda6f761ebe16a62124578ca0779d9365.tar.gz linux-stable-61b1a7fbda6f761ebe16a62124578ca0779d9365.tar.bz2 linux-stable-61b1a7fbda6f761ebe16a62124578ca0779d9365.zip |
Bluetooth: Fix address value for early disconnection events
We need to ensure that we do not send events to user space with the
identity address if we have not yet notified user space of the IRK. The
code was previously trying to handle this for the mgmt_pair_device
response (which worked well enough) but this is not the only connection
related event that might be sent to user space before pairing is
successful: another important event is Device Disconnected.
The issue can actually be solved more simply than the solution
previously used for mgmt_pair_device. Since we do have the identity
address tracked as part of the remote IRK struct we can just copy it
over from there to the hci_conn struct once we've for real sent the mgmt
event for the new IRK.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/smp.c')
-rw-r--r-- | net/bluetooth/smp.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 13919ff82e05..8d618e4654a5 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c @@ -1058,12 +1058,6 @@ static int smp_cmd_ident_addr_info(struct l2cap_conn *conn, smp->remote_irk = hci_add_irk(conn->hcon->hdev, &smp->id_addr, smp->id_addr_type, smp->irk, &rpa); - /* Track the connection based on the Identity Address from now on */ - bacpy(&hcon->dst, &smp->id_addr); - hcon->dst_type = smp->id_addr_type; - - l2cap_conn_update_id_addr(hcon); - smp_distribute_keys(conn); return 0; @@ -1214,8 +1208,16 @@ static void smp_notify_keys(struct l2cap_conn *conn) struct smp_cmd_pairing *rsp = (void *) &smp->prsp[1]; bool persistent; - if (smp->remote_irk) + if (smp->remote_irk) { mgmt_new_irk(hdev, smp->remote_irk); + /* Now that user space can be considered to know the + * identity address track the connection based on it + * from now on. + */ + bacpy(&hcon->dst, &smp->remote_irk->bdaddr); + hcon->dst_type = smp->remote_irk->addr_type; + l2cap_conn_update_id_addr(hcon); + } /* The LTKs and CSRKs should be persistent only if both sides * had the bonding bit set in their authentication requests. |