diff options
| author | Poul-Henning Kamp <phk@FreeBSD.org> | 1999-11-20 13:18:04 +0000 |
|---|---|---|
| committer | Poul-Henning Kamp <phk@FreeBSD.org> | 1999-11-20 13:18:04 +0000 |
| commit | 1fe96d232aef488736af71de8a240f280b46c700 (patch) | |
| tree | 36c8771e7e1f8540be097dceff8f392c8d427d1c | |
| parent | dc4511d5eb82cfaf19337c2de6c35dccccf07159 (diff) | |
Notes
| -rw-r--r-- | sys/miscfs/devfs/devfs_vnops.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/sys/miscfs/devfs/devfs_vnops.c b/sys/miscfs/devfs/devfs_vnops.c index d64ce80dd1d6..08feee282231 100644 --- a/sys/miscfs/devfs/devfs_vnops.c +++ b/sys/miscfs/devfs/devfs_vnops.c @@ -1340,28 +1340,20 @@ devfs_open( struct vop_open_args *ap) dsw = devsw(dev); if ( (dsw == NULL) || (dsw->d_open == NULL)) return ENXIO; - if (ap->a_cred != FSCRED && (ap->a_mode & FWRITE)) { + if (ap->a_cred != FSCRED && (ap->a_mode & FWRITE) && + vn_isdisk(vp)) { /* * When running in very secure mode, do not allow - * opens for writing of any disk character devices. + * opens for writing of any disk devices. */ - if (securelevel >= 2 - && dsw->d_bmaj != -1 - && (dsw->d_flags & D_TYPEMASK) == D_DISK) + if (securelevel >= 2) return (EPERM); /* * When running in secure mode, do not allow opens - * for writing of character - * devices whose corresponding block devices are - * currently mounted. + * for writing if the device is mounted. */ - if (securelevel >= 1) { - if ((bdev = chrtoblk(dev)) != NODEV && - vfinddev(bdev, VBLK, &bvp) && - bvp->v_usecount > 0 && - (error = vfs_mountedon(bvp))) - return (error); - } + if (securelevel >= 1 && vp->v_specmountpoint != NULL) + return (EPERM); } if ((dsw->d_flags & D_TYPEMASK) == D_TTY) vp->v_flag |= VISTTY; |
