summaryrefslogtreecommitdiff
path: root/sys/kern/vfs_syscalls.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2008-01-22 14:33:41 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2008-01-22 14:33:41 +0000
commit0a23539aa30aae4d5ec54df116f20d6297f54a83 (patch)
treec2c5a2da4c1f04846fb866fdc58caa4df9bacb28 /sys/kern/vfs_syscalls.c
parentf0652a1bf03361f14799b2b3b0eade445ec337f2 (diff)
Fix a double VOP_UNLOCK() that was introduced into the error path
in rev 1.141. From Christian Ehrhardt and Pedro Martelletto. OK hshoexer@ miod@
Diffstat (limited to 'sys/kern/vfs_syscalls.c')
-rw-r--r--sys/kern/vfs_syscalls.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index d199a3c2819..ff7851c71f9 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.144 2007/11/28 16:56:46 tedu Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.145 2008/01/22 14:33:40 millert Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -1057,8 +1057,10 @@ sys_fhopen(struct proc *p, void *v, register_t *retval)
type |= F_WAIT;
VOP_UNLOCK(vp, 0, p);
error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, type);
- if (error)
+ if (error) {
+ vp = NULL; /* closef will vn_close the file */
goto bad;
+ }
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
fp->f_flag |= FHASLOCK;
}