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/5cd43b255dc9
branches:  trunk
changeset: 764073:5cd43b255dc9
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Apr 11 02:16:27 2011 +0000

description:
description:
Ensure we don't leak stale pointers out in ni_dvp or ni_vp on error return.

diffstat:

 sys/kern/vfs_lookup.c |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (44 lines):

diff -r 90e77cb021f0 -r 5cd43b255dc9 sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c     Mon Apr 11 02:16:07 2011 +0000
+++ b/sys/kern/vfs_lookup.c     Mon Apr 11 02:16:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_lookup.c,v 1.158 2011/04/11 02:16:07 dholland Exp $        */
+/*     $NetBSD: vfs_lookup.c,v 1.159 2011/04/11 02:16:27 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.158 2011/04/11 02:16:07 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.159 2011/04/11 02:16:27 dholland Exp $");
 
 #include "opt_magiclinks.h"
 
@@ -1377,6 +1377,12 @@
                                  0/*!neverfollow*/, 0/*!inhibitmagic*/);
        namei_cleanup(&state);
 
+       if (error) {
+               /* make sure no stray refs leak out */
+               ndp->ni_dvp = NULL;
+               ndp->ni_vp = NULL;
+       }
+
        return error;
 }
 
@@ -1407,6 +1413,12 @@
                                  neverfollow, 1/*inhibitmagic*/);
        namei_cleanup(&state);
 
+       if (error) {
+               /* make sure no stray refs leak out */
+               ndp->ni_dvp = NULL;
+               ndp->ni_vp = NULL;
+       }
+
        return error;
 }
 



Home | Main Index | Thread Index | Old Index