summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_subr.c
diff options
context:
space:
mode:
authoranton <anton@openbsd.org>2019-01-21 18:09:21 +0000
committeranton <anton@openbsd.org>2019-01-21 18:09:21 +0000
commit6bd4f7ca0ef936d4e355b60a534d1efc45dff893 (patch)
tree7c0bf8ea9ece81fca5c96fbb924db82043892e20 /sys/kern/vfs_subr.c
parentUse the actual handshake message type in the certificate request handler. (diff)
downloadwireguard-openbsd-6bd4f7ca0ef936d4e355b60a534d1efc45dff893.tar.xz
wireguard-openbsd-6bd4f7ca0ef936d4e355b60a534d1efc45dff893.zip
Introduce a dedicated entry point data structure for file locks. This new data
structure allows for better tracking of pending lock operations which is essential in order to prevent a use-after-free once the underlying vnode is gone. Inspired by the lockf implementation in FreeBSD. ok visa@ Reported-by: syzbot+d5540a236382f50f1dac@syzkaller.appspotmail.com
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r--sys/kern/vfs_subr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 4e888b98f27..a15481c73f9 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.284 2018/12/23 10:46:51 natano Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.285 2019/01/21 18:09:21 anton Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -52,6 +52,7 @@
#include <sys/conf.h>
#include <sys/vnode.h>
#include <sys/lock.h>
+#include <sys/lockf.h>
#include <sys/stat.h>
#include <sys/acct.h>
#include <sys/namei.h>
@@ -1150,6 +1151,7 @@ vgonel(struct vnode *vp, struct proc *p)
vx->v_flag &= ~VALIASED;
vp->v_flag &= ~VALIASED;
}
+ lf_purgelocks(vp->v_speclockf);
free(vp->v_specinfo, M_VNODE, sizeof(struct specinfo));
vp->v_specinfo = NULL;
}