summaryrefslogtreecommitdiff
path: root/sys/miscfs
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2012-10-10 06:55:25 +0000
committerdholland <dholland@NetBSD.org>2012-10-10 06:55:25 +0000
commitfd87bfdf684980ecaa9617556d01aaa7a7ca8a93 (patch)
treeb18161364fb1753ffcbe24c1223c115b2db2dd72 /sys/miscfs
parent09963ce2540b09d804e53bdf2052da541d87fdee (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/miscfs')
-rw-r--r--sys/miscfs/genfs/layer_vnops.c8
1 files changed, 5 insertions, 3 deletions
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;