Skip to content

Scheduler: fix a NULL pointer dereference#11003

Merged
kv2019i merged 2 commits into
thesofproject:mainfrom
lyakh:sched
Jul 17, 2026
Merged

Scheduler: fix a NULL pointer dereference#11003
kv2019i merged 2 commits into
thesofproject:mainfrom
lyakh:sched

Conversation

@lyakh

@lyakh lyakh commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Fix a regressions when assertions and DRAM execution debugging are enabled.

lyakh added 2 commits July 16, 2026 14:16
Fix a NULL dereference when a __cold function is called before
schedulers are initilised on that core and
CONFIG_COLD_STORE_EXECUTE_DEBUG=y and assertions are enabled.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
scheduler_register() and scheduler_init() are never called on hot
paths, make them cold.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the scheduler/LL-domain lookup path against uninitialized scheduler state to prevent NULL-pointer dereferences, particularly when assertions and cold/DRAM execution debugging are enabled.

Changes:

  • Make zephyr_ll_domain() NULL-safe when the LL scheduler has not been registered yet.
  • Update ll_sch_is_current() to tolerate an unavailable LL domain and reliably return false instead of faulting.
  • Mark scheduler registration/initialization as cold paths and add assert_can_be_cold() instrumentation; make scheduler_get_data() return NULL when scheduler lists are not yet initialized.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/schedule/zephyr_ll.c Avoids dereferencing NULL when LL scheduler data is unavailable; returns NULL domain safely.
src/schedule/zephyr_domain.c Prevents LL-thread context checks from faulting when LL domain is not initialized.
src/schedule/schedule.c Adds cold-path annotations and cold-store debug assertions to scheduler init/registration.
src/include/sof/schedule/schedule.h Makes scheduler_get_data() return NULL if scheduler list is not initialized.

Comment thread src/schedule/zephyr_ll.c
@@ -769,5 +769,5 @@ struct ll_schedule_domain *zephyr_ll_domain(void)
{
@kv2019i
kv2019i merged commit 69ea9d3 into thesofproject:main Jul 17, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants