Page MenuHomeFreeBSD

D34128.diff
No OneTemporary

D34128.diff

diff --git a/sys/dev/filemon/filemon.c b/sys/dev/filemon/filemon.c
--- a/sys/dev/filemon/filemon.c
+++ b/sys/dev/filemon/filemon.c
@@ -359,9 +359,10 @@
filemon_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag __unused,
struct thread *td)
{
- int error = 0;
struct filemon *filemon;
+ struct file *fp;
struct proc *p;
+ int error;
if ((error = devfs_get_cdevpriv((void **) &filemon)) != 0)
return (error);
@@ -376,12 +377,21 @@
break;
}
- error = fget_write(td, *(int *)data,
- &cap_pwrite_rights,
- &filemon->fp);
- if (error == 0)
+ error = fget_write(td, *(int *)data, &cap_pwrite_rights, &fp);
+ if (error == 0) {
+ /*
+ * The filemon handle may be passed to another process,
+ * so the underlying file handle must support this.
+ */
+ if ((fp->f_ops->fo_flags & DFLAG_PASSABLE) == 0) {
+ fdrop(fp, curthread);
+ error = EINVAL;
+ break;
+ }
+ filemon->fp = fp;
/* Write the file header. */
filemon_write_header(filemon);
+ }
break;
/* Set the monitored process ID. */

File Metadata

Mime Type
text/plain
Expires
Thu, Oct 30, 4:29 AM (9 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24440119
Default Alt Text
D34128.diff (1 KB)

Event Timeline