Skip to content

Commit 8162e58

Browse files
pabigotnashif
authored andcommitted
kernel: sched: assert when k_sleep invoked from interrupt context
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]>
1 parent 218b45b commit 8162e58

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/sched.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,8 @@ s32_t z_impl_k_sleep(int ms)
10201020
{
10211021
s32_t ticks;
10221022

1023+
__ASSERT(!arch_is_in_isr(), "");
1024+
10231025
if (ms == K_FOREVER) {
10241026
k_thread_suspend(_current);
10251027
return K_FOREVER;

0 commit comments

Comments
 (0)