Skip to content

Commit 6661952

Browse files
lylezhu2012fabiobaltieri
authored andcommitted
Bluetooth: Classic: SSP: Fix bonding flag mismatch issue
A bonding issue is found with following conditions, a. Local is a SSP initiator and it is in non-bondable mode, b. Peer is in bondable mode, c. The bonding flag in Authentication_Requirements of local IOCAP is `No Bonding`, d. the bonding flag in Authentication_Requirements of peer IOCAP is `Bonding`. The bonding information will be exchanged and stored. It is incorrect behavior. Fix the issue by reporting a pairing failure and disconnecting the ACL connection with error `BT_HCI_ERR_AUTH_FAIL`. Signed-off-by: Lyle Zhu <[email protected]>
1 parent 1e5f8ba commit 6661952

File tree

1 file changed

+19
-0
lines changed
  • subsys/bluetooth/host/classic

1 file changed

+19
-0
lines changed

subsys/bluetooth/host/classic/ssp.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,25 @@ void bt_hci_io_capa_resp(struct net_buf *buf)
644644
return;
645645
}
646646

647+
if (atomic_test_bit(conn->flags, BT_CONN_BR_PAIRING_INITIATOR) &&
648+
(evt->authentication > BT_HCI_NO_BONDING_MITM) &&
649+
!atomic_test_bit(conn->flags, BT_CONN_BR_BONDABLE)) {
650+
/*
651+
* BLUETOOTH CORE SPECIFICATION Version 6.0 | Vol 3, Part C, section 9.4.2.
652+
* A device in the non-bondable mode does not allow a bond to be created with a
653+
* peer device.
654+
*
655+
* If the local is SSP initiator and non-bondable mode, and the bonding is required
656+
* by peer device, reports the pairing failure and disconnects the ACL connection
657+
* with error `BT_HCI_ERR_AUTH_FAIL`.
658+
*/
659+
LOG_WRN("Bonding flag mismatch (initiator:false != responder:true)");
660+
ssp_pairing_complete(conn, bt_security_err_get(BT_HCI_ERR_AUTH_FAIL));
661+
bt_conn_disconnect(conn, BT_HCI_ERR_AUTH_FAIL);
662+
bt_conn_unref(conn);
663+
return;
664+
}
665+
647666
conn->br.remote_io_capa = evt->capability;
648667
conn->br.remote_auth = evt->authentication;
649668
atomic_set_bit(conn->flags, BT_CONN_BR_PAIRING);

0 commit comments

Comments
 (0)