diff options
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_procctl.c | 2 | ||||
-rw-r--r-- | sys/kern/sys_generic.c | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index e6a142b2a7ac..9e860e7c80a5 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -1123,7 +1123,7 @@ sys_procctl(struct thread *td, struct procctl_args *uap) if (uap->com >= PROC_PROCCTL_MD_MIN) return (cpu_procctl(td, uap->idtype, uap->id, uap->com, uap->data)); - if (uap->com == 0 || uap->com >= nitems(procctl_cmds_info)) + if (uap->com <= 0 || uap->com >= nitems(procctl_cmds_info)) return (EINVAL); cmd_info = &procctl_cmds_info[uap->com]; bzero(&x, sizeof(x)); diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 32f137f0cb4c..a0a13e77131b 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -2018,11 +2018,16 @@ kcmp_cmp(uintptr_t a, uintptr_t b) static int kcmp_pget(struct thread *td, pid_t pid, struct proc **pp) { + int error; + if (pid == td->td_proc->p_pid) { *pp = td->td_proc; return (0); } - return (pget(pid, PGET_CANDEBUG | PGET_NOTWEXIT | PGET_HOLD, pp)); + error = pget(pid, PGET_NOTID | PGET_CANDEBUG | PGET_NOTWEXIT | + PGET_HOLD, pp); + MPASS(*pp != td->td_proc); + return (error); } int |