From 99a43d36c83d318f24edd8c6d80f060686a6c398 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Fri, 29 May 2015 14:44:39 +0200 Subject: kern: fix argument handling Previously, the processor argument was not checked. If called with a non-processor argument (like a task), `processor' is set to NULL, triggering a page fault. Likewise for the other functions. * kern/processor.c (processor_get_assignment): Fix argument handling. * kern/task.c (task_get_assignment): Likewise. * kern/thread.c (thread_get_assignment): Likewise. --- kern/thread.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'kern/thread.c') diff --git a/kern/thread.c b/kern/thread.c index f52c95b8..8b1e9f58 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -1974,6 +1974,9 @@ kern_return_t thread_get_assignment( thread_t thread, processor_set_t *pset) { + if (thread == THREAD_NULL) + return KERN_INVALID_ARGUMENT; + *pset = thread->processor_set; pset_reference(*pset); return KERN_SUCCESS; -- cgit v1.2.3