diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-09-05 15:19:54 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-09-08 13:07:56 -0400 |
commit | c6e81e9ae61cae3ea265e8f7fb2cbe59afc63594 (patch) | |
tree | f461861ae6903364c440fdea59bd374eaf61ab70 /net/bluetooth/smp.c | |
parent | 88d3a8acf33e8f4989a1032998eb819a89829573 (diff) |
Bluetooth: Fix calling smp_distribute_keys() when still waiting for keys
When we're in the process of receiving keys in phase 3 of SMP we keep
track of which keys are still expected in the smp->remote_key_dist
variable. If we still have some key bits set we need to continue waiting
for more PDUs and not needlessly call smp_distribute_keys(). This patch
fixes two such cases in the smp_cmd_master_ident() and
smp_cmd_ident_addr_info() handler functions.
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 | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 5003d224c4b6..e76c963011e5 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -1293,7 +1293,7 @@ static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb) | |||
1293 | authenticated, smp->tk, smp->enc_key_size, | 1293 | authenticated, smp->tk, smp->enc_key_size, |
1294 | rp->ediv, rp->rand); | 1294 | rp->ediv, rp->rand); |
1295 | smp->ltk = ltk; | 1295 | smp->ltk = ltk; |
1296 | if (!(smp->remote_key_dist & SMP_DIST_ID_KEY)) | 1296 | if (!(smp->remote_key_dist & KEY_DIST_MASK)) |
1297 | smp_distribute_keys(smp); | 1297 | smp_distribute_keys(smp); |
1298 | hci_dev_unlock(hdev); | 1298 | hci_dev_unlock(hdev); |
1299 | 1299 | ||
@@ -1371,7 +1371,8 @@ static int smp_cmd_ident_addr_info(struct l2cap_conn *conn, | |||
1371 | smp->id_addr_type, smp->irk, &rpa); | 1371 | smp->id_addr_type, smp->irk, &rpa); |
1372 | 1372 | ||
1373 | distribute: | 1373 | distribute: |
1374 | smp_distribute_keys(smp); | 1374 | if (!(smp->remote_key_dist & KEY_DIST_MASK)) |
1375 | smp_distribute_keys(smp); | ||
1375 | 1376 | ||
1376 | hci_dev_unlock(hcon->hdev); | 1377 | hci_dev_unlock(hcon->hdev); |
1377 | 1378 | ||