Commit 09fa5c11 authored by Ben Pfaff's avatar Ben Pfaff
Browse files

thread: Properly protect 'all_list' around insertion.

Reported by Francis Russell <>.
parent b913988a
......@@ -459,6 +459,8 @@ is_thread (struct thread *t)
static void
init_thread (struct thread *t, const char *name, int priority)
enum intr_level old_level;
ASSERT (PRI_MIN <= priority && priority <= PRI_MAX);
ASSERT (name != NULL);
......@@ -469,7 +471,10 @@ init_thread (struct thread *t, const char *name, int priority)
t->stack = (uint8_t *) t + PGSIZE;
t->priority = priority;
t->magic = THREAD_MAGIC;
old_level = intr_disable ();
list_push_back (&all_list, &t->allelem);
intr_set_level (old_level);
/* Allocates a SIZE-byte frame at the top of thread T's stack and
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment