Skip to content

Commit 07ebf3d

Browse files
andrzej-kaczmarekcarlescufi
authored andcommitted
Bluetooth: controller: Release resources on failed AUX_CONNECT_RSP
We allocate nodes on receiving AUX_CONNECT_REQ, but we can only use them if AUX_CONNECT_RSP is sent successfully. If that fails, we need to release those nodes. Signed-off-by: Andrzej Kaczmarek <[email protected]>
1 parent 3fc74be commit 07ebf3d

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_aux.c

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -640,25 +640,40 @@ static void isr_tx_connect_rsp(void *param)
640640
struct node_rx_ftr *ftr;
641641
struct node_rx_pdu *rx;
642642
struct lll_adv *lll;
643+
bool is_done;
643644
int ret;
644645

645646
rx = param;
646647
ftr = &(rx->hdr.rx_ftr);
647648
lll = ftr->param;
648649

649-
if (!radio_is_done()) {
650-
/* TODO: release node_rx somehow */
651-
return;
652-
}
650+
is_done = radio_is_done();
653651

654-
/* Clear radio status and events */
655-
lll_isr_status_reset();
656-
lll_isr_cleanup(lll);
652+
if (!is_done) {
653+
/* AUX_CONNECT_RSP was not sent properly, need to release
654+
* allocated resources and keep advertising.
655+
*/
657656

658-
/* Stop further LLL radio events */
659-
ret = lll_stop(lll);
660-
LL_ASSERT(!ret);
657+
rx->hdr.type = NODE_RX_TYPE_RELEASE;
658+
659+
if (IS_ENABLED(CONFIG_BT_CTLR_CHAN_SEL_2)) {
660+
ull_rx_put(rx->hdr.link, rx);
661+
662+
rx = ftr->extra;
663+
rx->hdr.type = NODE_RX_TYPE_RELEASE;
664+
}
665+
}
661666

662667
ull_rx_put(rx->hdr.link, rx);
663668
ull_rx_sched();
669+
670+
if (is_done) {
671+
/* Stop further LLL radio events */
672+
ret = lll_stop(lll);
673+
LL_ASSERT(!ret);
674+
}
675+
676+
/* Clear radio status and events */
677+
lll_isr_status_reset();
678+
lll_isr_cleanup(lll);
664679
}

0 commit comments

Comments
 (0)