summaryrefslogtreecommitdiffstats
path: root/sys/dev/filemon
diff options
context:
space:
mode:
authorhrs <hrs@FreeBSD.org>2013-08-02 14:44:11 +0000
committerhrs <hrs@FreeBSD.org>2013-08-02 14:44:11 +0000
commit2d3c928904a804c62206b6bec50d0030becd77f3 (patch)
tree429c54d6bdf1bc324e920aa0f9b5a832fbf413f7 /sys/dev/filemon
parent713e53c6b93f362bd026ade64f87d8fc3b0e70a0 (diff)
downloadFreeBSD-src-2d3c928904a804c62206b6bec50d0030becd77f3.zip
FreeBSD-src-2d3c928904a804c62206b6bec50d0030becd77f3.tar.gz
Add p_candebug() check to FILEMON_SET_PID ioctl.
Discussed with: sjg MFC after: 3 days
Diffstat (limited to 'sys/dev/filemon')
-rw-r--r--sys/dev/filemon/filemon.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/filemon/filemon.c b/sys/dev/filemon/filemon.c
index f05710b..c82a816 100644
--- a/sys/dev/filemon/filemon.c
+++ b/sys/dev/filemon/filemon.c
@@ -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:
OpenPOWER on IntegriCloud