Module Name: src Committed By: hannken Date: Wed Mar 1 10:43:37 UTC 2017
Modified Files: src/sys/kern: vfs_vnops.c Log Message: Must always lock the parent -> lock the child -> unlock the parent. To generate a diff of this commit: cvs rdiff -u -r1.193 -r1.194 src/sys/kern/vfs_vnops.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_vnops.c diff -u src/sys/kern/vfs_vnops.c:1.193 src/sys/kern/vfs_vnops.c:1.194 --- src/sys/kern/vfs_vnops.c:1.193 Wed Feb 4 07:09:37 2015 +++ src/sys/kern/vfs_vnops.c Wed Mar 1 10:43:37 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_vnops.c,v 1.193 2015/02/04 07:09:37 msaitoh Exp $ */ +/* $NetBSD: vfs_vnops.c,v 1.194 2017/03/01 10:43:37 hannken Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.193 2015/02/04 07:09:37 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.194 2017/03/01 10:43:37 hannken Exp $"); #include "veriexec.h" @@ -210,12 +210,14 @@ vn_open(struct nameidata *ndp, int fmode va.va_vaflags |= VA_EXCLUSIVE; error = VOP_CREATE(ndp->ni_dvp, &ndp->ni_vp, &ndp->ni_cnd, &va); - vput(ndp->ni_dvp); - if (error) + if (error) { + vput(ndp->ni_dvp); goto out; + } fmode &= ~O_TRUNC; vp = ndp->ni_vp; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vput(ndp->ni_dvp); } else { VOP_ABORTOP(ndp->ni_dvp, &ndp->ni_cnd); if (ndp->ni_dvp == ndp->ni_vp)