From 203b5859a145309cfb12a93e993be232fc18ecb9 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Mon, 30 Sep 2019 14:02:45 +0530 Subject: [PATCH] Bluetooth: controller: split: Fix flushing Tx buffers in HCI Fix for possible Tx Buffer leak during disconnection when the buffers are in HCI thread context and not yet demux-ed and enqueued towards LLL context. Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/ull_conn.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn.c b/subsys/bluetooth/controller/ll_sw/ull_conn.c index 4a66ef8f05b..07005cdc1d3 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn.c @@ -1532,6 +1532,9 @@ static void conn_cleanup(struct ll_conn *conn) ll_rx_put(rx->hdr.link, rx); } + /* TODO: flush demux-ed Tx buffer still in ULL context */ + LL_ASSERT(!conn->tx_head); + /* Enable Ticker Job, we are in a radio event which disabled it if * worker0 and job0 priority where same. */ @@ -1547,6 +1550,9 @@ static void conn_cleanup(struct ll_conn *conn) /* Invalidate the connection context */ lll->handle = 0xFFFF; + + /* Demux and flush Tx PDUs that remain enqueued in thread context */ + ull_conn_tx_demux(UINT8_MAX); } #if defined(CONFIG_BT_CTLR_LLID_DATA_START_EMPTY)