Skip to content

Commit

Permalink
kernel: sched: assert when k_sleep invoked from interrupt context
Browse files Browse the repository at this point in the history
Fix a gap where k_sleep(K_FOREVER) could execute a code path that
would not verify that the call was not from interrupt context.

Signed-off-by: Peter Bigot <[email protected]>
  • Loading branch information
pabigot authored and nashif committed Dec 13, 2019
1 parent 218b45b commit 8162e58
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,8 @@ s32_t z_impl_k_sleep(int ms)
{
s32_t ticks;

__ASSERT(!arch_is_in_isr(), "");

if (ms == K_FOREVER) {
k_thread_suspend(_current);
return K_FOREVER;
Expand Down

0 comments on commit 8162e58

Please sign in to comment.