1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

Fix a couple of silly mistakes in r291962.

- Handle the case where no DOF helper is provided. This occurs with the
  currently-unused DTRACEHIOC_ADD ioctl.
- Fix some checks that prevented the loading DOF in the (non-default)
  lazyload mode.
This commit is contained in:
Mark Johnston 2016-03-08 00:46:03 +00:00
parent 380344a7af
commit 9610c89750
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=296480

View File

@ -47,14 +47,14 @@ dtrace_ioctl_helper(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
/* FALLTHROUGH */
case DTRACEHIOC_ADD:
p = curproc;
if (p->p_pid == dhp->dofhp_pid) {
if (dhp == NULL || p->p_pid == dhp->dofhp_pid) {
dof = dtrace_dof_copyin((uintptr_t)addr, &rval);
} else {
p = pfind(dhp->dofhp_pid);
if (p == NULL)
return (EINVAL);
if (!P_SHOULDSTOP(p) ||
(p->p_flag & P_TRACED|P_WEXIT) == 0 ||
(p->p_flag & (P_TRACED | P_WEXIT)) != P_TRACED ||
p->p_pptr != curproc) {
PROC_UNLOCK(p);
return (EINVAL);