Proc locking to protect p_ucred while we obtain additional references.
This commit is contained in:
parent
1e3e44f22f
commit
cfb4c0b4f9
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user