Skip to content

Commit 0cc5dc1

Browse files
joerchannashif
authored andcommitted
Bluetooth: host: Don't call callbacks on unexpected SMP PDUs
When receiving unexpected SMP PDUs with no pairing procedures in progress don't treat it as a pairing procedure that has failed. This causes unexpected SMP PDUs to trigger the pairing failed and security changed callback at unexpected times. Signed-off-by: Joakim Andersson <[email protected]>
1 parent 500ac36 commit 0cc5dc1

File tree

1 file changed

+6
-2
lines changed
  • subsys/bluetooth/host

1 file changed

+6
-2
lines changed

subsys/bluetooth/host/smp.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1915,8 +1915,12 @@ static int smp_error(struct bt_smp *smp, uint8_t reason)
19151915
struct bt_smp_pairing_fail *rsp;
19161916
struct net_buf *buf;
19171917

1918-
/* reset context and report */
1919-
smp_pairing_complete(smp, reason);
1918+
if (atomic_test_bit(smp->flags, SMP_FLAG_PAIRING) ||
1919+
atomic_test_bit(smp->flags, SMP_FLAG_ENC_PENDING) ||
1920+
atomic_test_bit(smp->flags, SMP_FLAG_SEC_REQ)) {
1921+
/* reset context and report */
1922+
smp_pairing_complete(smp, reason);
1923+
}
19201924

19211925
buf = smp_create_pdu(smp, BT_SMP_CMD_PAIRING_FAIL, sizeof(*rsp));
19221926
if (!buf) {

0 commit comments

Comments
 (0)