diff options
author | jhb <jhb@FreeBSD.org> | 2001-01-23 23:59:30 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-01-23 23:59:30 +0000 |
commit | f5fbc62142d116619713e03561896c38676e6f5c (patch) | |
tree | ffb7ad41d16e1a81dfd4020c7e40b16883eb312e /sys/i386 | |
parent | 08fe94fb944365cc4b0fb414189679bba283eb4b (diff) | |
download | FreeBSD-src-f5fbc62142d116619713e03561896c38676e6f5c.zip FreeBSD-src-f5fbc62142d116619713e03561896c38676e6f5c.tar.gz |
- Use 'p' instead of 'curproc' for the namei lookup as this is what
other image activators use.
- Proc locking.
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/ibcs2/imgact_coff.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/sys/i386/ibcs2/imgact_coff.c b/sys/i386/ibcs2/imgact_coff.c index 16dbd6e..066648b 100644 --- a/sys/i386/ibcs2/imgact_coff.c +++ b/sys/i386/ibcs2/imgact_coff.c @@ -156,6 +156,7 @@ 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; @@ -166,8 +167,7 @@ coff_load_file(struct proc *p, char *name) unsigned long bss_size = 0; int i; - /* XXX use of 'curproc' should be 'p'?*/ - NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME, UIO_SYSSPACE, name, curproc); + NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME, UIO_SYSSPACE, name, p); error = namei(&nd); if (error) @@ -182,24 +182,38 @@ coff_load_file(struct proc *p, char *name) goto fail; } - if ((error = VOP_GETATTR(vp, &attr, p->p_ucred, p)) != 0) + PROC_LOCK(p); + uc = p->p_ucred; + crhold(uc); + PROC_UNLOCK(p); + if ((error = VOP_GETATTR(vp, &attr, uc, p)) != 0) { + crfree(uc); goto fail; + } if ((vp->v_mount->mnt_flag & MNT_NOEXEC) || ((attr.va_mode & 0111) == 0) - || (attr.va_type != VREG)) + || (attr.va_type != VREG)) { + crfree(uc); goto fail; + } if (attr.va_size == 0) { error = ENOEXEC; + crfree(uc); goto fail; } - if ((error = VOP_ACCESS(vp, VEXEC, p->p_ucred, p)) != 0) + if ((error = VOP_ACCESS(vp, VEXEC, uc, p)) != 0) { + crfree(uc); goto fail; + } - if ((error = VOP_OPEN(vp, FREAD, p->p_ucred, p)) != 0) + if ((error = VOP_OPEN(vp, FREAD, uc, p)) != 0) { + crfree(uc); goto fail; + } + crfree(uc); /* * Lose the lock on the vnode. It's no longer needed, and must not |