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 <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2019-03-29 16:25:27 -07:00 committed by Anas Nashif
parent b4987a2c57
commit ae0d1b2b79

View File

@ -587,6 +587,8 @@ void *z_get_next_switch_handle(void *interrupted)
{
_current->switch_handle = interrupted;
z_check_stack_sentinel();
#ifdef CONFIG_SMP
LOCKED(&sched_spinlock) {
struct k_thread *th = next_up();
@ -617,9 +619,6 @@ void *z_get_next_switch_handle(void *interrupted)
!IS_ENABLED(CONFIG_SCHED_IPI_SUPPORTED)) {
z_sched_ipi();
}
z_check_stack_sentinel();
return _current->switch_handle;
}
#endif