Skip to content

Commit aaab223

Browse files
lylezhu2012aescolar
authored andcommitted
Bluetooth: SSP: Incorrect bonding status notified
The `bonded` flag of the callback `pairing_complete` is always true, event if the SSP pairing is non-bondable. Check the bonding status in SSP complete event instead of in link key notify event. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
1 parent a00d508 commit aaab223

File tree

1 file changed

+5
-10
lines changed
  • subsys/bluetooth/host/classic

1 file changed

+5
-10
lines changed

subsys/bluetooth/host/classic/ssp.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -479,11 +479,6 @@ void bt_hci_link_key_notify(struct net_buf *buf)
479479
conn->br.link_key->flags |= BT_LINK_KEY_AUTHENTICATED;
480480
__fallthrough;
481481
case BT_LK_UNAUTH_COMBINATION_P192:
482-
/* Mark no-bond so that link-key is removed on disconnection */
483-
if (ssp_get_auth(conn) < BT_HCI_DEDICATED_BONDING) {
484-
atomic_set_bit(conn->flags, BT_CONN_BR_NOBOND);
485-
}
486-
487482
memcpy(conn->br.link_key->val, evt->link_key, 16);
488483
break;
489484
case BT_LK_AUTH_COMBINATION_P256:
@@ -492,11 +487,6 @@ void bt_hci_link_key_notify(struct net_buf *buf)
492487
case BT_LK_UNAUTH_COMBINATION_P256:
493488
conn->br.link_key->flags |= BT_LINK_KEY_SC;
494489

495-
/* Mark no-bond so that link-key is removed on disconnection */
496-
if (ssp_get_auth(conn) < BT_HCI_DEDICATED_BONDING) {
497-
atomic_set_bit(conn->flags, BT_CONN_BR_NOBOND);
498-
}
499-
500490
memcpy(conn->br.link_key->val, evt->link_key, 16);
501491
break;
502492
default:
@@ -720,6 +710,11 @@ void bt_hci_ssp_complete(struct net_buf *buf)
720710
return;
721711
}
722712

713+
/* Mark no-bond so that link-key will be removed on disconnection */
714+
if (ssp_get_auth(conn) < BT_HCI_DEDICATED_BONDING) {
715+
atomic_set_bit(conn->flags, BT_CONN_BR_NOBOND);
716+
}
717+
723718
ssp_pairing_complete(conn, bt_security_err_get(evt->status));
724719
if (evt->status) {
725720
bt_conn_disconnect(conn, BT_HCI_ERR_AUTH_FAIL);

0 commit comments

Comments
 (0)