Module Name: src Committed By: dholland Date: Mon Apr 11 02:18:07 UTC 2011
Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: Don't assign ni_vp until namei_oneroot() returns. To generate a diff of this commit: cvs rdiff -u -r1.164 -r1.165 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.164 src/sys/kern/vfs_lookup.c:1.165 --- src/sys/kern/vfs_lookup.c:1.164 Mon Apr 11 02:17:54 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:18:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.164 2011/04/11 02:17:54 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.165 2011/04/11 02:18:07 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.164 2011/04/11 02:17:54 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.165 2011/04/11 02:18:07 dholland Exp $"); #include "opt_magiclinks.h" @@ -1103,7 +1103,6 @@ if (cnp->cn_nameptr[0] == '\0') { vref(searchdir); foundobj = searchdir; - ndp->ni_vp = foundobj; cnp->cn_flags |= ISLASTCN; /* bleh */ @@ -1137,7 +1136,6 @@ return (error); } KASSERT(ndp->ni_dvp == NULL); - ndp->ni_vp = foundobj; if (foundobj == NULL) { /* @@ -1171,13 +1169,13 @@ * symlink in. (FUTURE) */ error = namei_follow(state, inhibitmagic, - searchdir, ndp->ni_vp, + searchdir, foundobj, &searchdir); } if (error) { - KASSERT(searchdir != ndp->ni_vp); + KASSERT(searchdir != foundobj); vput(searchdir); - vput(ndp->ni_vp); + vput(foundobj); KASSERT(ndp->ni_dvp == NULL); ndp->ni_vp = NULL; return error; @@ -1240,7 +1238,6 @@ foundobj = ndp->ni_rootdir; vref(foundobj); vn_lock(foundobj, LK_EXCLUSIVE | LK_RETRY); - ndp->ni_vp = foundobj; } /* @@ -1307,7 +1304,7 @@ * If LOCKPARENT is not set, the parent directory isn't returned. */ if ((cnp->cn_flags & LOCKPARENT) == 0 && searchdir != NULL) { - if (searchdir == ndp->ni_vp) { + if (searchdir == foundobj) { vrele(searchdir); } else { vput(searchdir); @@ -1316,6 +1313,7 @@ } ndp->ni_dvp = searchdir; + ndp->ni_vp = foundobj; return 0; }