1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

cpu/fe310: don't call thread_yield when sched_active_thread is invalid

As the comment above cpu_switch_context_exit notes:

	sched_active_thread is not valid when cpu_switch_context_exit() is called.

Unfortunately, thread_yield(), which is called directly by
cpu_switch_context_exit(), uses sched_active_thread possibly resulting
in a null pointer dereference.

Solution: Trigger a software interrupt to perform a context switch and
let sched_run() determine the next valid thread from there.
This commit is contained in:
Sören Tempel 2019-08-28 18:09:05 +02:00
parent d6ac49c26e
commit 0e724e3d5d

View File

@ -334,8 +334,8 @@ void cpu_switch_context_exit(void)
/* enable interrupts */ /* enable interrupts */
irq_enable(); irq_enable();
/* start the thread */ /* start the thread by triggering a context switch */
thread_yield(); thread_yield_higher();
UNREACHABLE(); UNREACHABLE();
} }