summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroga <oga@openbsd.org>2009-12-17 16:44:12 +0000
committeroga <oga@openbsd.org>2009-12-17 16:44:12 +0000
commit1a550b67ce793545a4d63bf80d716fdf621d0748 (patch)
treef185539228bc442ae084745854272fc5f110d103
parentThis fixes a case where we could panic on a null deref with a bad vnode (diff)
downloadwireguard-openbsd-1a550b67ce793545a4d63bf80d716fdf621d0748.tar.xz
wireguard-openbsd-1a550b67ce793545a4d63bf80d716fdf621d0748.zip
if anyone vref()s a VNON vnode, panic. This should not happen.
Written while trying to debug the nfs_inactive panics. Turns out it never got hit, but it's a useful check to have. ok beck@
-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 698a523b42f..9e804880ad0 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.183 2009/08/17 13:11:58 jasper Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.184 2009/12/17 16:44:12 oga Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -630,6 +630,8 @@ vref(struct vnode *vp)
#ifdef DIAGNOSTIC
if (vp->v_usecount == 0)
panic("vref used where vget required");
+ if (vp->v_type == VNON)
+ panic("vref on a VNON vnode");
#endif
vp->v_usecount++;
}