summaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
authorPaul Irofti <pirofti@cvs.openbsd.org>2013-04-10 12:58:53 +0000
committerPaul Irofti <pirofti@cvs.openbsd.org>2013-04-10 12:58:53 +0000
commitba306cd6345b4a1b1901745ccec9a63764c59b6d (patch)
tree2c7b382ec8fb6eab3d5e2bb4e15951ce9a758db6 /sys/compat
parent5c56a6a1f6d6808046a0821966cd9167e52d32a6 (diff)
futex: Assert that the refcount is larger than 0 when doing futex_put.
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linux/linux_futex.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c
index 04a37c51eaf..8442c6b63ef 100644
--- a/sys/compat/linux/linux_futex.c
+++ b/sys/compat/linux/linux_futex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_futex.c,v 1.11 2013/01/15 10:47:35 guenther Exp $ */
+/* $OpenBSD: linux_futex.c,v 1.12 2013/04/10 12:58:52 pirofti Exp $ */
/* $NetBSD: linux_futex.c,v 1.26 2010/07/07 01:30:35 chs Exp $ */
/*-
@@ -474,6 +474,7 @@ void
futex_put(struct futex *f)
{
MUTEX_ASSERT_LOCKED(&futex_lock);
+ KASSERT(f->f_refcount > 0);
f->f_refcount--;
if (f->f_refcount == 0) {
KASSERT(TAILQ_EMPTY(&f->f_waiting_proc));