aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/uipc_mqueue.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/uipc_mqueue.c')
-rw-r--r--sys/kern/uipc_mqueue.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/uipc_mqueue.c b/sys/kern/uipc_mqueue.c
index 309fa3423fbd..dc94ce213d08 100644
--- a/sys/kern/uipc_mqueue.c
+++ b/sys/kern/uipc_mqueue.c
@@ -1569,7 +1569,8 @@ mqfs_prison_remove(void *obj, void *data __unused)
found = 0;
TAILQ_FOREACH(tpr, &allprison, pr_list) {
prison_lock(tpr);
- if (tpr->pr_root == pr->pr_root && tpr != pr && tpr->pr_ref > 0)
+ if (tpr != pr && prison_isvalid(tpr) &&
+ tpr->pr_root == pr->pr_root)
found = 1;
prison_unlock(tpr);
}