summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_descrip.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r--sys/kern/kern_descrip.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 4527346..79b8e41 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1315,7 +1315,7 @@ fdopen(dev, mode, type, p)
* actions in dupfdopen below. Other callers of vn_open or VOP_OPEN
* will simply report the error.
*/
- p->p_dupfd = minor(dev);
+ p->p_dupfd = dev2unit(dev);
return (ENODEV);
}
@@ -1478,6 +1478,13 @@ fildesc_clone(void *arg, char *name, int namelen, dev_t *dev)
return;
if (u <= 2)
return;
+ /* Don't clone higher than it makes sense */
+ if (u >= maxfilesperproc)
+ return;
+ /* And don't clone higher than our minors will support */
+ if (u > 0xffffff)
+ return;
+ u = unit2minor(u);
*dev = make_dev(&fildesc_cdevsw, u, UID_BIN, GID_BIN, 0666, name);
return;
}
OpenPOWER on IntegriCloud