From 9aa540391b13682c718a751a3a92b1c5b25866d3 Mon Sep 17 00:00:00 2001 From: itojun Date: Fri, 19 Jul 2002 23:55:01 +0000 Subject: [PATCH] add missing systrace_{un,}lock in systrace_poll. reported to provos. don't use MALLOC() with variable size. from openbsd. --- sys/kern/kern_systrace.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_systrace.c b/sys/kern/kern_systrace.c index 41d9b4f1a03d..0c285bc74ebc 100644 --- a/sys/kern/kern_systrace.c +++ b/sys/kern/kern_systrace.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_systrace.c,v 1.7 2002/07/16 19:53:37 christos Exp $ */ +/* $NetBSD: kern_systrace.c,v 1.8 2002/07/19 23:55:01 itojun Exp $ */ /* * Copyright 2002 Niels Provos @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_systrace.c,v 1.7 2002/07/16 19:53:37 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_systrace.c,v 1.8 2002/07/19 23:55:01 itojun Exp $"); #include "opt_systrace.h" @@ -395,7 +395,9 @@ systracef_poll(struct file *fp, int events, struct proc *p) if ((events & (POLLIN | POLLRDNORM)) == 0) return (revents); + systrace_lock(); SYSTRACE_LOCK(fst, p); + systrace_unlock(); if (TAILQ_EMPTY(&fst->messages) == 0) revents |= events & (POLLIN | POLLRDNORM); else @@ -1137,7 +1139,7 @@ systrace_closepolicy(struct fsystrace *fst, struct str_policy *policy) fst->npolicies--; if (policy->nsysent) - FREE(policy->sysent, M_XDATA); + free(policy->sysent, M_XDATA); TAILQ_REMOVE(&fst->policies, policy, next); @@ -1186,7 +1188,7 @@ systrace_newpolicy(struct fsystrace *fst, int maxents) memset((caddr_t)pol, 0, sizeof(struct str_policy)); - MALLOC(pol->sysent, u_char *, maxents * sizeof(u_char), + pol->sysent = (u_char *)malloc(maxents * sizeof(u_char), M_XDATA, M_WAITOK); pol->nsysent = maxents; for (i = 0; i < maxents; i++)