From f540aca98452ae3328bb85b3019b403196f8d16d Mon Sep 17 00:00:00 2001 From: jhb Date: Wed, 24 Jan 2001 00:26:19 +0000 Subject: Proc locking to protect p_ucred while we obtain additional references. --- sys/isofs/cd9660/cd9660_vfsops.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'sys/isofs/cd9660') diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c index aaefb78..cd58e6d 100644 --- a/sys/isofs/cd9660/cd9660_vfsops.c +++ b/sys/isofs/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); -- cgit v1.1