summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2007-08-06 16:58:26 +0000
committermillert <millert@openbsd.org>2007-08-06 16:58:26 +0000
commit36a0338b6977e2df1da16634b2affa11cbbced82 (patch)
tree9d7a89acac13831d93a776398038ed43e71ac567
parentSpew smbios bios table vendor/version/release date into the dmesg. Diff (diff)
downloadwireguard-openbsd-36a0338b6977e2df1da16634b2affa11cbbced82.tar.xz
wireguard-openbsd-36a0338b6977e2df1da16634b2affa11cbbced82.zip
Fix error path in sys_fhopen() if VOP_ADVLOCK fails. Spotted by aaron@
-rw-r--r--sys/kern/vfs_syscalls.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 5b425a0bb21..19706a0c923 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.140 2007/06/14 20:36:34 otto Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.141 2007/08/06 16:58:26 millert Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -1059,12 +1059,8 @@ 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) {
- /* closef will vn_close the file for us. */
- fdremove(fdp, indx);
- closef(fp, p);
- return (error);
- }
+ if (error)
+ goto bad;
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
fp->f_flag |= FHASLOCK;
}