Change procfs_lookup to not allow delete/rename operations

to prevent panics when a user tries to remove/rename the
contents of /proc/###/*.

Obtained from: 4.4BSD-lite2
This commit is contained in:
mpp 1995-09-02 18:28:48 +00:00
parent 2f44cdc7e1
commit 325b318783
2 changed files with 12 additions and 6 deletions

View File

@ -36,7 +36,7 @@
*
* @(#)procfs_vnops.c 8.6 (Berkeley) 2/7/94
*
* $Id: procfs_vnops.c,v 1.14 1995/05/30 08:07:13 rgrimes Exp $
* $Id: procfs_vnops.c,v 1.15 1995/08/11 07:26:26 davidg Exp $
*/
/*
@ -536,6 +536,11 @@ procfs_lookup(ap)
pfstype pfs_type;
int i;
*vpp = NULL;
if (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)
return (EROFS);
if (cnp->cn_namelen == 1 && *pname == '.') {
*vpp = dvp;
VREF(dvp);
@ -543,8 +548,6 @@ procfs_lookup(ap)
return (0);
}
*vpp = NULL;
pfs = VTOPFS(dvp);
switch (pfs->pfs_type) {
case Proot:

View File

@ -36,7 +36,7 @@
*
* @(#)procfs_vnops.c 8.6 (Berkeley) 2/7/94
*
* $Id: procfs_vnops.c,v 1.14 1995/05/30 08:07:13 rgrimes Exp $
* $Id: procfs_vnops.c,v 1.15 1995/08/11 07:26:26 davidg Exp $
*/
/*
@ -536,6 +536,11 @@ procfs_lookup(ap)
pfstype pfs_type;
int i;
*vpp = NULL;
if (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)
return (EROFS);
if (cnp->cn_namelen == 1 && *pname == '.') {
*vpp = dvp;
VREF(dvp);
@ -543,8 +548,6 @@ procfs_lookup(ap)
return (0);
}
*vpp = NULL;
pfs = VTOPFS(dvp);
switch (pfs->pfs_type) {
case Proot: