Skip to content

Commit c6e81e9

Browse files
Johan Hedbergholtmann
authored andcommitted
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>
1 parent 88d3a8a commit c6e81e9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

net/bluetooth/smp.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb)
12931293
authenticated, smp->tk, smp->enc_key_size,
12941294
rp->ediv, rp->rand);
12951295
smp->ltk = ltk;
1296-
if (!(smp->remote_key_dist & SMP_DIST_ID_KEY))
1296+
if (!(smp->remote_key_dist & KEY_DIST_MASK))
12971297
smp_distribute_keys(smp);
12981298
hci_dev_unlock(hdev);
12991299

@@ -1371,7 +1371,8 @@ static int smp_cmd_ident_addr_info(struct l2cap_conn *conn,
13711371
smp->id_addr_type, smp->irk, &rpa);
13721372

13731373
distribute:
1374-
smp_distribute_keys(smp);
1374+
if (!(smp->remote_key_dist & KEY_DIST_MASK))
1375+
smp_distribute_keys(smp);
13751376

13761377
hci_dev_unlock(hcon->hdev);
13771378

0 commit comments

Comments
 (0)