sched_rr_get_interval(2): Use copyout(9) for the interval argument.
authorSascha Wildner <saw@online.de>
Tue, 19 Jan 2010 04:38:26 +0000 (05:38 +0100)
committerSascha Wildner <saw@online.de>
Tue, 19 Jan 2010 04:39:27 +0000 (05:39 +0100)
This fixes a panic discovered when NULL was passed as interval.

sys/kern/kern_p1003_1b.c

index df4a249..03ae40e 100644 (file)
@@ -310,11 +310,13 @@ sys_sched_rr_get_interval(struct sched_rr_get_interval_args *uap)
        int e;
        struct proc *p = curproc;
        struct lwp *lp = curthread->td_lwp;
+       struct timespec ts;
 
        get_mplock();
        if ((e = p31b_proc(p, uap->pid, &p)) == 0) {
-               e = ksched_rr_get_interval(&uap->sysmsg_reg, ksched,
-                                          lp, uap->interval);
+               e = ksched_rr_get_interval(&uap->sysmsg_reg, ksched, lp, &ts);
+               if (e == 0)
+                       e = copyout(&ts, uap->interval, sizeof(ts));
        }
        rel_mplock();
        return e;