Skip to content

Commit d1a10bc

Browse files
erbr-othenrikbrixandersen
authored andcommitted
Bluetooth: controller: fix node_rx retention mechanism
Ensure that in LLCP reference to node_rx is cleared when retention is NOT used, to avoid corruption of node_rx later re-allocated Signed-off-by: Erik Brockhoff <[email protected]> (cherry picked from commit 806a4fc) Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent a3ca8d0 commit d1a10bc

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

subsys/bluetooth/controller/ll_sw/ull_llcp_local.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,11 @@ void llcp_lr_rx(struct ll_conn *conn, struct proc_ctx *ctx, memq_link_t *link,
318318
break;
319319
}
320320

321+
/* If rx node was not retained clear reference */
322+
if (ctx->node_ref.rx && ctx->node_ref.rx->hdr.type != NODE_RX_TYPE_RETAIN) {
323+
ctx->node_ref.rx = NULL;
324+
}
325+
321326
llcp_lr_check_done(conn, ctx);
322327
}
323328

subsys/bluetooth/controller/ll_sw/ull_llcp_remote.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,12 @@ void llcp_rr_rx(struct ll_conn *conn, struct proc_ctx *ctx, memq_link_t *link,
313313
LL_ASSERT(0);
314314
break;
315315
}
316+
317+
/* If rx node was not retained clear reference */
318+
if (ctx->node_ref.rx && ctx->node_ref.rx->hdr.type != NODE_RX_TYPE_RETAIN) {
319+
ctx->node_ref.rx = NULL;
320+
}
321+
316322
llcp_rr_check_done(conn, ctx);
317323
}
318324

0 commit comments

Comments
 (0)