Skip to content

Commit ae0d1b2

Browse files
Andrew Boienashif
authored andcommitted
kernel: sched: move stack sentinel check earlier
Checking the stack sentinel may abort the current thread, make this check before we determine what the next thread to run is. Fixes: #15037 Signed-off-by: Andrew Boie <[email protected]>
1 parent b4987a2 commit ae0d1b2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

kernel/sched.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,8 @@ void *z_get_next_switch_handle(void *interrupted)
587587
{
588588
_current->switch_handle = interrupted;
589589

590+
z_check_stack_sentinel();
591+
590592
#ifdef CONFIG_SMP
591593
LOCKED(&sched_spinlock) {
592594
struct k_thread *th = next_up();
@@ -617,9 +619,6 @@ void *z_get_next_switch_handle(void *interrupted)
617619
!IS_ENABLED(CONFIG_SCHED_IPI_SUPPORTED)) {
618620
z_sched_ipi();
619621
}
620-
621-
z_check_stack_sentinel();
622-
623622
return _current->switch_handle;
624623
}
625624
#endif

0 commit comments

Comments
 (0)