Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Fix vnode leak on error, introduced by the openat f...



details:   https://anonhg.NetBSD.org/src/rev/af33fd6892e8
branches:  trunk
changeset: 825335:af33fd6892e8
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Jul 09 22:48:44 2017 +0000

description:
Fix vnode leak on error, introduced by the openat family changes in -r1.200.
>From mjg@freebsd.

diffstat:

 sys/kern/vfs_lookup.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 7e8457ab311d -r af33fd6892e8 sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c     Sun Jul 09 22:18:43 2017 +0000
+++ b/sys/kern/vfs_lookup.c     Sun Jul 09 22:48:44 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_lookup.c,v 1.207 2017/06/01 02:45:13 chs Exp $     */
+/*     $NetBSD: vfs_lookup.c,v 1.208 2017/07/09 22:48:44 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.207 2017/06/01 02:45:13 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.208 2017/07/09 22:48:44 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_magiclinks.h"
@@ -673,8 +673,10 @@
        }
 
        /* NDAT may feed us with a non directory namei_getstartdir */
-       if (startdir->v_type != VDIR)
+       if (startdir->v_type != VDIR) {
+               vrele(startdir);
                return ENOTDIR;
+       }
 
        vn_lock(startdir, LK_EXCLUSIVE | LK_RETRY);
 



Home | Main Index | Thread Index | Old Index