diff options
author | jhb <jhb@FreeBSD.org> | 2001-01-24 00:26:19 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-01-24 00:26:19 +0000 |
commit | f540aca98452ae3328bb85b3019b403196f8d16d (patch) | |
tree | 67e87a4b8cdeb7e4dad6edcb98f70c264bd9002c /sys/fs | |
parent | 733f2050f9bc39673c915b3da76b2d14cd4932a6 (diff) | |
download | FreeBSD-src-f540aca98452ae3328bb85b3019b403196f8d16d.zip FreeBSD-src-f540aca98452ae3328bb85b3019b403196f8d16d.tar.gz |
Proc locking to protect p_ucred while we obtain additional references.
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/cd9660/cd9660_vfsops.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index aaefb78..cd58e6d 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -183,6 +183,7 @@ cd9660_mount(mp, path, data, ndp, p) { struct vnode *devvp; struct iso_args args; + struct ucred *uc; size_t size; int error; mode_t accessmode; @@ -227,7 +228,12 @@ cd9660_mount(mp, path, data, ndp, p) */ accessmode = VREAD; vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); - error = VOP_ACCESS(devvp, accessmode, p->p_ucred, p); + PROC_LOCK(p); + uc = p->p_ucred; + crhold(uc); + PROC_UNLOCK(p); + error = VOP_ACCESS(devvp, accessmode, uc, p); + crfree(uc); if (error) error = suser(p); if (error) { @@ -271,6 +277,7 @@ iso_mountfs(devvp, mp, p, argp) register struct iso_mnt *isomp = (struct iso_mnt *)0; struct buf *bp = NULL; struct buf *pribp = NULL, *supbp = NULL; + struct ucred *uc; dev_t dev = devvp->v_rdev; int error = EINVAL; int needclose = 0; @@ -298,7 +305,13 @@ iso_mountfs(devvp, mp, p, argp) return error; if (vcount(devvp) > 1 && devvp != rootvp) return EBUSY; - if ((error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0))) + PROC_LOCK(p); + uc = p->p_ucred; + crhold(uc); + PROC_UNLOCK(p); + error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0); + crfree(uc); + if (error) return (error); vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); |