Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys In layer_lookup(), clear *vpp before returning EROFS, as...
details: https://anonhg.NetBSD.org/src/rev/24bb1fcdc7d3
branches: trunk
changeset: 781959:24bb1fcdc7d3
user: dholland <dholland%NetBSD.org@localhost>
date: Wed Oct 10 06:55:25 2012 +0000
description:
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:
sys/kern/vfs_lookup.c | 5 +++--
sys/miscfs/genfs/layer_vnops.c | 8 +++++---
2 files changed, 8 insertions(+), 5 deletions(-)
diffs (56 lines):
diff -r 7096d036199c -r 24bb1fcdc7d3 sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c Wed Oct 10 02:16:54 2012 +0000
+++ b/sys/kern/vfs_lookup.c Wed Oct 10 06:55:25 2012 +0000
@@ -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 @@
/*
* 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 -r 7096d036199c -r 24bb1fcdc7d3 sys/miscfs/genfs/layer_vnops.c
--- a/sys/miscfs/genfs/layer_vnops.c Wed Oct 10 02:16:54 2012 +0000
+++ b/sys/miscfs/genfs/layer_vnops.c Wed Oct 10 06:55:25 2012 +0000
@@ -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 @@
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;
Home |
Main Index |
Thread Index |
Old Index