Module Name:    src
Committed By:   dholland
Date:           Sun Jul  9 22:48:44 UTC 2017

Modified Files:
        src/sys/kern: vfs_lookup.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.207 -r1.208 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.207 src/sys/kern/vfs_lookup.c:1.208
--- src/sys/kern/vfs_lookup.c:1.207	Thu Jun  1 02:45:13 2017
+++ src/sys/kern/vfs_lookup.c	Sun Jul  9 22:48:44 2017
@@ -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 @@ namei_start(struct namei_state *state, i
 	}
 
 	/* 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);
 

Reply via email to