sched: enforce ref-counting on current task/thread pointers
This commit is contained in:
+12
-3
@@ -3,9 +3,13 @@
|
||||
|
||||
kern_status_t sys_kern_handle_close(kern_handle_t handle)
|
||||
{
|
||||
struct task *self = current_task();
|
||||
struct task *self = get_current_task();
|
||||
|
||||
return task_close_handle(self, handle);
|
||||
kern_status_t status = task_close_handle(self, handle);
|
||||
|
||||
put_current_task(self);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
kern_status_t sys_kern_handle_transfer(
|
||||
@@ -24,10 +28,11 @@ kern_status_t sys_kern_handle_transfer(
|
||||
return KERN_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
struct task *self = current_task();
|
||||
struct task *self = get_current_task();
|
||||
|
||||
if (out_handle
|
||||
&& !validate_access_w(self, out_handle, sizeof *out_handle)) {
|
||||
put_current_task(self);
|
||||
return KERN_MEMORY_FAULT;
|
||||
}
|
||||
|
||||
@@ -120,6 +125,8 @@ kern_status_t sys_kern_handle_transfer(
|
||||
*out_handle = dest_handle;
|
||||
}
|
||||
|
||||
put_current_task(self);
|
||||
|
||||
return KERN_OK;
|
||||
|
||||
cleanup:
|
||||
@@ -135,5 +142,7 @@ cleanup:
|
||||
object_unref(src_object);
|
||||
}
|
||||
|
||||
put_current_task(self);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user