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 <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
500ac369ed
commit
0cc5dc1839
1 changed files with 6 additions and 2 deletions
|
@ -1915,8 +1915,12 @@ static int smp_error(struct bt_smp *smp, uint8_t reason)
|
|||
struct bt_smp_pairing_fail *rsp;
|
||||
struct net_buf *buf;
|
||||
|
||||
/* reset context and report */
|
||||
smp_pairing_complete(smp, reason);
|
||||
if (atomic_test_bit(smp->flags, SMP_FLAG_PAIRING) ||
|
||||
atomic_test_bit(smp->flags, SMP_FLAG_ENC_PENDING) ||
|
||||
atomic_test_bit(smp->flags, SMP_FLAG_SEC_REQ)) {
|
||||
/* reset context and report */
|
||||
smp_pairing_complete(smp, reason);
|
||||
}
|
||||
|
||||
buf = smp_create_pdu(smp, BT_SMP_CMD_PAIRING_FAIL, sizeof(*rsp));
|
||||
if (!buf) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue