Bluetooth: Audio: Fix issue with non-bonded devices in has.c

The HAS implementation of the security_changed callback
expected all devices to have bonded, and thus always added them
to the ntf_bonded implementation.

This adds a check to whether the device is actually bonded.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2022-12-14 21:48:53 +01:00 committed by Carles Cufí
commit e3fcf8267a

View file

@ -200,7 +200,8 @@ static void security_changed(struct bt_conn *conn, bt_security_t level, enum bt_
LOG_DBG("conn %p level %d err %d", (void *)conn, level, err);
if (err != BT_SECURITY_ERR_SUCCESS) {
if (err != BT_SECURITY_ERR_SUCCESS ||
!bt_addr_le_is_bonded(conn->id, &conn->le.dst)) {
return;
}