Skip to content

Commit 93f8326

Browse files
cvinayakmbolivar-nordic
authored andcommitted
[nrf fromtree] Bluetooth: Controller: Fix reset of is_aux_sched flag
Fix reset of is_aux_sched flag when closing the primary and auxiliary PDU reception. Without this fix when scan window is closed there would be duplicate auxiliary release message generated causing memory corruption. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]> (cherry picked from commit 0748474) (cherry picked from commit 0b8acca)
1 parent 3aa82d2 commit 93f8326

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,8 @@ static void isr_done_cleanup(void *param)
10151015
if (lll->is_aux_sched) {
10161016
struct node_rx_pdu *node_rx;
10171017

1018+
lll->is_aux_sched = 0U;
1019+
10181020
node_rx = ull_pdu_rx_alloc();
10191021
LL_ASSERT(node_rx);
10201022

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,8 @@ static void isr_rx(struct lll_scan *lll, struct lll_scan_aux *lll_aux,
850850
* context or auxiliary PDU reception by aux context
851851
*/
852852
if (lll->is_aux_sched) {
853+
lll->is_aux_sched = 0U;
854+
853855
/* Go back to resuming primary channel scanning */
854856
radio_isr_set(lll_scan_isr_resume, lll);
855857
} else {
@@ -1214,11 +1216,6 @@ static int isr_rx_pdu(struct lll_scan *lll, struct lll_scan_aux *lll_aux,
12141216
ftr->param = lll;
12151217
ftr->scan_rsp = lll->lll_aux->state;
12161218

1217-
/* Auxiliary PDU received by LLL scheduling by scan
1218-
* context.
1219-
*/
1220-
lll->is_aux_sched = 1U;
1221-
12221219
/* Further auxiliary PDU reception will be chain PDUs */
12231220
lll->lll_aux->is_chain_sched = 1U;
12241221
} else {
@@ -1266,18 +1263,22 @@ static int isr_rx_pdu(struct lll_scan *lll, struct lll_scan_aux *lll_aux,
12661263

12671264
ull_rx_sched();
12681265

1269-
/* Increase trx count so as to not generate done extra event
1270-
* as a valid Auxiliary PDU node rx is being reported to ULL.
1271-
*/
1272-
trx_cnt++;
1273-
12741266
/* Next aux scan is scheduled from LLL, we already handled radio
12751267
* disable so prevent caller from doing it again.
12761268
*/
12771269
if (ftr->aux_lll_sched) {
1270+
if (!lll_aux) {
1271+
lll->is_aux_sched = 1U;
1272+
}
1273+
12781274
return 0;
12791275
}
12801276

1277+
/* Increase trx count so as to not generate done extra event
1278+
* as a valid Auxiliary PDU node rx is being reported to ULL.
1279+
*/
1280+
trx_cnt++;
1281+
12811282
return -ECANCELED;
12821283
}
12831284

0 commit comments

Comments
 (0)