Skip to content

Commit ce32cc4

Browse files
committed
Bluetooth: controller: Fix ticker job_guard
Move the ticker job_guard reset to after ticker_job_compare_update, so that the ticks_current and ticks_slot_previous are updated before ticker_worker gets to execute. Without this fix, there is a possibility that ticker_worker will use incorrect ticks_slot_previous and ticks_current value under race conditions. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent d587145 commit ce32cc4

File tree

1 file changed

+3
-3
lines changed
  • subsys/bluetooth/controller/ticker

1 file changed

+3
-3
lines changed

subsys/bluetooth/controller/ticker/ticker.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2364,14 +2364,14 @@ void ticker_job(void *param)
23642364
ticker_job_list_inquire(instance);
23652365
}
23662366

2367-
/* Permit worker job to run */
2368-
instance->job_guard = 0U;
2369-
23702367
/* update compare if head changed */
23712368
if (flag_compare_update) {
23722369
ticker_job_compare_update(instance, ticker_id_old_head);
23732370
}
23742371

2372+
/* Permit worker to run */
2373+
instance->job_guard = 0U;
2374+
23752375
/* trigger worker if deferred */
23762376
if (instance->worker_trigger) {
23772377
instance->sched_cb(TICKER_CALL_ID_JOB, TICKER_CALL_ID_WORKER, 1,

0 commit comments

Comments
 (0)