Commit c6e81e9a authored by Johan Hedberg's avatar Johan Hedberg Committed by Marcel Holtmann

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: default avatarJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 88d3a8ac
...@@ -1293,7 +1293,7 @@ static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb) ...@@ -1293,7 +1293,7 @@ static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb)
authenticated, smp->tk, smp->enc_key_size, authenticated, smp->tk, smp->enc_key_size,
rp->ediv, rp->rand); rp->ediv, rp->rand);
smp->ltk = ltk; smp->ltk = ltk;
if (!(smp->remote_key_dist & SMP_DIST_ID_KEY)) if (!(smp->remote_key_dist & KEY_DIST_MASK))
smp_distribute_keys(smp); smp_distribute_keys(smp);
hci_dev_unlock(hdev); hci_dev_unlock(hdev);
...@@ -1371,7 +1371,8 @@ static int smp_cmd_ident_addr_info(struct l2cap_conn *conn, ...@@ -1371,7 +1371,8 @@ static int smp_cmd_ident_addr_info(struct l2cap_conn *conn,
smp->id_addr_type, smp->irk, &rpa); smp->id_addr_type, smp->irk, &rpa);
distribute: distribute:
smp_distribute_keys(smp); if (!(smp->remote_key_dist & KEY_DIST_MASK))
smp_distribute_keys(smp);
hci_dev_unlock(hcon->hdev); hci_dev_unlock(hcon->hdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment