diff options
author | jhb <jhb@FreeBSD.org> | 2001-01-27 00:01:31 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-01-27 00:01:31 +0000 |
commit | b6baa60b1e807d09641c20b2ff1fe838ddebbd3b (patch) | |
tree | 81781cbbf3ad98f73e64d11188dfe3084b844e12 /sys/i386/ibcs2 | |
parent | 0c5b7b7672ac24978496b6d8b72a9f4c74349b64 (diff) | |
download | FreeBSD-src-b6baa60b1e807d09641c20b2ff1fe838ddebbd3b.zip FreeBSD-src-b6baa60b1e807d09641c20b2ff1fe838ddebbd3b.tar.gz |
Back out proc locking to protect p_ucred for obtaining additional
references along with the actual obtaining of additional references.
Diffstat (limited to 'sys/i386/ibcs2')
-rw-r--r-- | sys/i386/ibcs2/ibcs2_util.c | 13 | ||||
-rw-r--r-- | sys/i386/ibcs2/imgact_coff.c | 23 |
2 files changed, 7 insertions, 29 deletions
diff --git a/sys/i386/ibcs2/ibcs2_util.c b/sys/i386/ibcs2/ibcs2_util.c index 1d710be..0a361fd 100644 --- a/sys/i386/ibcs2/ibcs2_util.c +++ b/sys/i386/ibcs2/ibcs2_util.c @@ -62,7 +62,6 @@ ibcs2_emul_find(p, sgp, prefix, path, pbuf, cflag) struct nameidata ndroot; struct vattr vat; struct vattr vatroot; - struct ucred *uc; int error; char *ptr, *buf, *cp; size_t sz, len; @@ -141,20 +140,14 @@ ibcs2_emul_find(p, sgp, prefix, path, pbuf, cflag) return error; } - PROC_LOCK(p); - uc = p->p_ucred; - crhold(uc); - PROC_UNLOCK(p); - if ((error = VOP_GETATTR(nd.ni_vp, &vat, uc, p)) != 0) { - crfree(uc); + if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, p)) != 0) { goto done; } - if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, uc, p)) != 0) { - crfree(uc); + if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, p->p_ucred, p)) + != 0) { goto done; } - crfree(uc); if (vat.va_fsid == vatroot.va_fsid && vat.va_fileid == vatroot.va_fileid) { diff --git a/sys/i386/ibcs2/imgact_coff.c b/sys/i386/ibcs2/imgact_coff.c index 066648b..e7cb544 100644 --- a/sys/i386/ibcs2/imgact_coff.c +++ b/sys/i386/ibcs2/imgact_coff.c @@ -156,7 +156,6 @@ coff_load_file(struct proc *p, char *name) struct nameidata nd; struct vnode *vp; struct vattr attr; - struct ucred *uc; struct filehdr *fhdr; struct aouthdr *ahdr; struct scnhdr *scns; @@ -182,38 +181,24 @@ coff_load_file(struct proc *p, char *name) goto fail; } - PROC_LOCK(p); - uc = p->p_ucred; - crhold(uc); - PROC_UNLOCK(p); - if ((error = VOP_GETATTR(vp, &attr, uc, p)) != 0) { - crfree(uc); + if ((error = VOP_GETATTR(vp, &attr, p->p_ucred, p)) != 0) goto fail; - } if ((vp->v_mount->mnt_flag & MNT_NOEXEC) || ((attr.va_mode & 0111) == 0) - || (attr.va_type != VREG)) { - crfree(uc); + || (attr.va_type != VREG)) goto fail; - } if (attr.va_size == 0) { error = ENOEXEC; - crfree(uc); goto fail; } - if ((error = VOP_ACCESS(vp, VEXEC, uc, p)) != 0) { - crfree(uc); + if ((error = VOP_ACCESS(vp, VEXEC, p->p_ucred, p)) != 0) goto fail; - } - if ((error = VOP_OPEN(vp, FREAD, uc, p)) != 0) { - crfree(uc); + if ((error = VOP_OPEN(vp, FREAD, p->p_ucred, p)) != 0) goto fail; - } - crfree(uc); /* * Lose the lock on the vnode. It's no longer needed, and must not |