diff options
| author | dholland <dholland@NetBSD.org> | 2012-10-10 06:55:25 +0000 |
|---|---|---|
| committer | dholland <dholland@NetBSD.org> | 2012-10-10 06:55:25 +0000 |
| commit | fd87bfdf684980ecaa9617556d01aaa7a7ca8a93 (patch) | |
| tree | b18161364fb1753ffcbe24c1223c115b2db2dd72 /sys | |
| parent | 09963ce2540b09d804e53bdf2052da541d87fdee (diff) | |
In layer_lookup(), clear *vpp before returning EROFS, as otherwise a
stale value can be returned and this causes a diagnostic panic in
namei.
In relookup(), clear *vpp before calling VOP_LOOKUP, as is done in
lookup_once(), as an additional precautionary measure.
(in theory both of these fixes are not required together)
Should fix PR 47040.
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/kern/vfs_lookup.c | 5 | ||||
| -rw-r--r-- | sys/miscfs/genfs/layer_vnops.c | 8 |
2 files changed, 8 insertions, 5 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 875466fbfb8..03429e5c1d1 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.194 2012/10/08 23:43:33 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.195 2012/10/10 06:55:25 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.194 2012/10/08 23:43:33 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.195 2012/10/10 06:55:25 dholland Exp $"); #include "opt_magiclinks.h" @@ -1708,6 +1708,7 @@ relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, int d /* * We now have a segment name to search for, and a directory to search. */ + *vpp = NULL; cnp->cn_flags |= INRELOOKUP; error = VOP_LOOKUP(dvp, vpp, cnp); cnp->cn_flags &= ~INRELOOKUP; diff --git a/sys/miscfs/genfs/layer_vnops.c b/sys/miscfs/genfs/layer_vnops.c index c67f2db4d33..a4779a47911 100644 --- a/sys/miscfs/genfs/layer_vnops.c +++ b/sys/miscfs/genfs/layer_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: layer_vnops.c,v 1.50 2011/07/11 08:34:01 hannken Exp $ */ +/* $NetBSD: layer_vnops.c,v 1.51 2012/10/10 06:55:25 dholland Exp $ */ /* * Copyright (c) 1999 National Aeronautics & Space Administration @@ -170,7 +170,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.50 2011/07/11 08:34:01 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.51 2012/10/10 06:55:25 dholland Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -353,8 +353,10 @@ layer_lookup(void *v) dvp = ap->a_dvp; if ((flags & ISLASTCN) && (dvp->v_mount->mnt_flag & MNT_RDONLY) && - (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) + (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) { + *ap->a_vpp = NULL; return EROFS; + } ldvp = LAYERVPTOLOWERVP(dvp); ap->a_dvp = ldvp; |
