Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern description:



details:   https://anonhg.NetBSD.org/src/rev/d91af51eb44f
branches:  trunk
changeset: 764078:d91af51eb44f
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Apr 11 02:17:54 2011 +0000

description:
description:
Make sure namei_oneroot leaves ni_dvp and ni_vp NULL on error.

diffstat:

 sys/kern/vfs_lookup.c |  17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diffs (66 lines):

diff -r 6c7797fdb4d8 -r d91af51eb44f sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c     Mon Apr 11 02:17:41 2011 +0000
+++ b/sys/kern/vfs_lookup.c     Mon Apr 11 02:17:54 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_lookup.c,v 1.163 2011/04/11 02:17:41 dholland Exp $        */
+/*     $NetBSD: vfs_lookup.c,v 1.164 2011/04/11 02:17:54 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.163 2011/04/11 02:17:41 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.164 2011/04/11 02:17:54 dholland Exp $");
 
 #include "opt_magiclinks.h"
 
@@ -592,7 +592,6 @@
         * POSIX.1 requirement: "" is not a valid file name.
         */
        if (ndp->ni_pathlen == 1) {
-               ndp->ni_vp = NULL;
                return ENOENT;
        }
 
@@ -1034,6 +1033,8 @@
 
        error = namei_start(state, forcecwd, &searchdir);
        if (error) {
+               ndp->ni_dvp = NULL;
+               ndp->ni_vp = NULL;
                return error;
        }
 
@@ -1057,6 +1058,8 @@
                 */
                if (searchdir->v_mount == NULL) {
                        vput(searchdir);
+                       ndp->ni_dvp = NULL;
+                       ndp->ni_vp = NULL;
                        return (ENOENT);
                }
 
@@ -1374,8 +1377,8 @@
 
        if (error) {
                /* make sure no stray refs leak out */
-               ndp->ni_dvp = NULL;
-               ndp->ni_vp = NULL;
+               KASSERT(ndp->ni_dvp == NULL);
+               KASSERT(ndp->ni_vp == NULL);
        }
 
        return error;
@@ -1410,8 +1413,8 @@
 
        if (error) {
                /* make sure no stray refs leak out */
-               ndp->ni_dvp = NULL;
-               ndp->ni_vp = NULL;
+               KASSERT(ndp->ni_dvp == NULL);
+               KASSERT(ndp->ni_vp == NULL);
        }
 
        return error;



Home | Main Index | Thread Index | Old Index