From 2935cac9d697a8fcdbcb5fa4fd49ebccbb3d0bae Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Tue, 20 Dec 2022 23:47:43 +0100 Subject: [PATCH] Bluetooth: Audio: Fix handling properly deleting endpoints When there is an ACL disconnect, or the unicast group is otherwise deleted, the endpoints were not properly handled, causing incorrect `dir` values and ASSERTs. Signed-off-by: Emil Gydesen --- subsys/bluetooth/audio/unicast_client.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/subsys/bluetooth/audio/unicast_client.c b/subsys/bluetooth/audio/unicast_client.c index 3942599016e..ce2908e1ab1 100644 --- a/subsys/bluetooth/audio/unicast_client.c +++ b/subsys/bluetooth/audio/unicast_client.c @@ -1479,11 +1479,18 @@ int bt_unicast_client_ep_send(struct bt_conn *conn, struct bt_audio_ep *ep, static void unicast_client_reset(struct bt_audio_ep *ep) { + struct bt_unicast_client_ep *client_ep = CONTAINER_OF(ep, struct bt_unicast_client_ep, ep); + LOG_DBG("ep %p", ep); bt_audio_stream_reset(ep->stream); (void)memset(ep, 0, sizeof(*ep)); + + client_ep->cp_handle = 0U; + client_ep->handle = 0U; + (void)memset(&client_ep->discover, 0, sizeof(client_ep->discover)); + /* Need to keep the subscribe params intact for the callback */ } static void unicast_client_ep_reset(struct bt_conn *conn)