Scheduler: fix a NULL pointer dereference#11003
Merged
Merged
Conversation
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>
lyakh
requested review from
LaurentiuM1234,
dbaluta,
kv2019i,
lbetlej,
lgirdwood,
marcinszkudlinski,
mmaka1,
pblaszko and
plbossart
as code owners
July 16, 2026 12:22
Contributor
There was a problem hiding this comment.
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 returnfalseinstead of faulting. - Mark scheduler registration/initialization as cold paths and add
assert_can_be_cold()instrumentation; makescheduler_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. |
| @@ -769,5 +769,5 @@ struct ll_schedule_domain *zephyr_ll_domain(void) | |||
| { | |||
kv2019i
approved these changes
Jul 16, 2026
tmleman
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix a regressions when assertions and DRAM execution debugging are enabled.