From owner-p4-projects@FreeBSD.ORG Wed May 31 08:24:34 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0E08716A428; Wed, 31 May 2006 08:24:34 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C3F7916A427 for ; Wed, 31 May 2006 08:24:33 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id F2A0143D53 for ; Wed, 31 May 2006 08:24:32 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k4V8NBXe044488 for ; Wed, 31 May 2006 08:23:12 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k4V8NBMQ044485 for perforce@freebsd.org; Wed, 31 May 2006 08:23:11 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Wed, 31 May 2006 08:23:11 GMT Message-Id: <200605310823.k4V8NBMQ044485@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 98193 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 May 2006 08:24:34 -0000 http://perforce.freebsd.org/chv.cgi?CH=98193 Change 98193 by rwatson@rwatson_zoo on 2006/05/31 08:23:09 Create audit_pipe_preselect_flush() from audit_pipe_preselect_flush_locked(), as we call the preselect flush routine both with and without the audit pipe mutex; with when closing the pipe, and without when the flush ioctl is called. Affected files ... .. //depot/projects/trustedbsd/audit3/sys/security/audit/audit_pipe.c#24 edit Differences ... ==== //depot/projects/trustedbsd/audit3/sys/security/audit/audit_pipe.c#24 (text+ko) ==== @@ -295,15 +295,24 @@ * Delete all per-auid masks on an audit pipe. */ static void -audit_pipe_preselect_flush(struct audit_pipe *ap) +audit_pipe_preselect_flush_locked(struct audit_pipe *ap) { struct audit_pipe_preselect *app; - mtx_lock(&audit_pipe_mtx); + mtx_assert(&audit_pipe_mtx, MA_OWNED); + while ((app = TAILQ_FIRST(&ap->ap_preselect_list)) != NULL) { TAILQ_REMOVE(&ap->ap_preselect_list, app, app_list); free(app, M_AUDIT_PIPE_PRESELECT); } +} + +static void +audit_pipe_preselect_flush(struct audit_pipe *ap) +{ + + mtx_lock(&audit_pipe_mtx); + audit_pipe_preselect_flush_locked(ap); mtx_unlock(&audit_pipe_mtx); } @@ -561,7 +570,7 @@ mtx_assert(&audit_pipe_mtx, MA_OWNED); - audit_pipe_preselect_flush(ap); + audit_pipe_preselect_flush_locked(ap); audit_pipe_flush(ap); TAILQ_REMOVE(&audit_pipe_list, ap, ap_list); free(ap, M_AUDIT_PIPE);