Skip to content

Commit 09eb7e0

Browse files
joerchannashif
authored andcommitted
Bluetooth: host: Terminate the pairing procedure when disconnected
Terminate the pairing procedure when disconnected while this was in progress. This notifies the application that security has failed and removes the key entry. Signed-off-by: Joakim Andersson <[email protected]>
1 parent 6b72e65 commit 09eb7e0

File tree

1 file changed

+7
-0
lines changed
  • subsys/bluetooth/host

1 file changed

+7
-0
lines changed

subsys/bluetooth/host/smp.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4506,6 +4506,13 @@ static void bt_smp_disconnected(struct bt_l2cap_chan *chan)
45064506

45074507
k_delayed_work_cancel(&smp->work);
45084508

4509+
if (atomic_test_bit(smp->flags, SMP_FLAG_PAIRING) ||
4510+
atomic_test_bit(smp->flags, SMP_FLAG_ENC_PENDING) ||
4511+
atomic_test_bit(smp->flags, SMP_FLAG_SEC_REQ)) {
4512+
/* reset context and report */
4513+
smp_pairing_complete(smp, BT_SMP_ERR_UNSPECIFIED);
4514+
}
4515+
45094516
if (keys) {
45104517
/*
45114518
* If debug keys were used for pairing remove them.

0 commit comments

Comments
 (0)