sched: enforce ref-counting on current task/thread pointers
This commit is contained in:
+6
-2
@@ -8,18 +8,22 @@ kern_status_t sys_futex_wait(
|
||||
kern_futex_t new_val,
|
||||
unsigned int flags)
|
||||
{
|
||||
struct task *self = current_task();
|
||||
struct task *self = get_current_task();
|
||||
if (!validate_access_r(self, futex, sizeof *futex)) {
|
||||
put_current_task(self);
|
||||
return KERN_MEMORY_FAULT;
|
||||
}
|
||||
|
||||
futex_key_t key;
|
||||
kern_status_t status = futex_get(futex, &key, flags);
|
||||
if (status != KERN_OK) {
|
||||
put_current_task(self);
|
||||
return status;
|
||||
}
|
||||
|
||||
return futex_wait(key, new_val, flags);
|
||||
status = futex_wait(key, new_val, flags);
|
||||
put_current_task(self);
|
||||
return status;
|
||||
}
|
||||
|
||||
kern_status_t sys_futex_wake(
|
||||
|
||||
Reference in New Issue
Block a user