Add p_candebug() check to FILEMON_SET_PID ioctl.
Discussed with: sjg MFC after: 3 days
This commit is contained in:
parent
9d6d5a7131
commit
872ce24739
@ -150,6 +150,7 @@ filemon_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag __unused,
|
||||
{
|
||||
int error = 0;
|
||||
struct filemon *filemon;
|
||||
struct proc *p;
|
||||
|
||||
devfs_get_cdevpriv((void **) &filemon);
|
||||
|
||||
@ -163,7 +164,13 @@ filemon_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag __unused,
|
||||
|
||||
/* Set the monitored process ID. */
|
||||
case FILEMON_SET_PID:
|
||||
filemon->pid = *((pid_t *)data);
|
||||
p = pfind(*((pid_t *)data));
|
||||
if (p == NULL)
|
||||
return (EINVAL);
|
||||
error = p_candebug(curthread, p);
|
||||
if (error == 0)
|
||||
filemon->pid = p->p_pid;
|
||||
PROC_UNLOCK(p);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user