Skip to content

Commit bfbe764

Browse files
lylezhu2012kartben
authored andcommitted
Bluetooth: Classic: Check LK before clearing it
After SSP has been completed and before LK event notification, the link key may be invalid when handling the ACL disconnection event. Check `conn->br.link_key` before calling the function `bt_keys_link_key_clear()` to clear it. Fixes #87880. Signed-off-by: Lyle Zhu <[email protected]>
1 parent 0103de7 commit bfbe764

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

subsys/bluetooth/host/hci_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ static void hci_disconn_complete(struct net_buf *buf)
10131013
* If only for one connection session bond was set, clear keys
10141014
* database row for this connection.
10151015
*/
1016-
if (conn->type == BT_CONN_TYPE_BR &&
1016+
if (conn->type == BT_CONN_TYPE_BR && conn->br.link_key != NULL &&
10171017
atomic_test_and_clear_bit(conn->flags, BT_CONN_BR_NOBOND)) {
10181018
bt_keys_link_key_clear(conn->br.link_key);
10191019
}

0 commit comments

Comments
 (0)