From e3fcf8267a2e7a4b5d39127c511f10efd52468ae Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Wed, 14 Dec 2022 21:48:53 +0100 Subject: [PATCH] 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 --- subsys/bluetooth/audio/has.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/audio/has.c b/subsys/bluetooth/audio/has.c index 45c5c4c2ed2..0a90f94a0f8 100644 --- a/subsys/bluetooth/audio/has.c +++ b/subsys/bluetooth/audio/has.c @@ -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; }