From 79942b47cc69074e0b06c29f6e9d291e1298a848 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Tue, 24 Mar 2020 12:53:40 +0530 Subject: [PATCH] Bluetooth: controller: legacy: Fix DLE duplicate requests Fix implementation to handle back-to-back and duplicate LENGTH_REQ PDU reception. Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/ctrl.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/ctrl.c b/subsys/bluetooth/controller/ll_sw/ctrl.c index 1b1c0307404..860976c00fa 100644 --- a/subsys/bluetooth/controller/ll_sw/ctrl.c +++ b/subsys/bluetooth/controller/ll_sw/ctrl.c @@ -2692,9 +2692,21 @@ static inline u8_t isr_rx_conn_pkt_ctrl_dle(struct pdu_data *pdu_data_rx, *rx_enqueue = 1U; } } else { - /* Drop response with no Local initiated request. */ - LL_ASSERT(pdu_data_rx->llctrl.opcode == - PDU_DATA_LLCTRL_TYPE_LENGTH_RSP); + /* Drop response with no Local initiated request and duplicate + * requests. + */ + if (pdu_data_rx->llctrl.opcode != + PDU_DATA_LLCTRL_TYPE_LENGTH_RSP) { + mem_release(node_tx, &_radio.pkt_tx_ctrl_free); + + /* Defer new request if previous in resize state */ + if (_radio.conn_curr->llcp_length.state == + LLCP_LENGTH_STATE_RESIZE) { + return 1U; + } + } + + return 0; } send_length_resp: