From owner-p4-projects@FreeBSD.ORG Wed Oct 25 20:57:33 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 2476416A4B3; Wed, 25 Oct 2006 20:57:33 +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 02A8816A4A0 for ; Wed, 25 Oct 2006 20:57:33 +0000 (UTC) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0B6BA43E8E for ; Wed, 25 Oct 2006 20:55:22 +0000 (GMT) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k9PKtGcI081916 for ; Wed, 25 Oct 2006 20:55:16 GMT (envelope-from millert@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k9PKtG3I081913 for perforce@freebsd.org; Wed, 25 Oct 2006 20:55:16 GMT (envelope-from millert@freebsd.org) Date: Wed, 25 Oct 2006 20:55:16 GMT Message-Id: <200610252055.k9PKtG3I081913@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to millert@freebsd.org using -f From: Todd Miller To: Perforce Change Reviews Cc: Subject: PERFORCE change 108432 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, 25 Oct 2006 20:57:33 -0000 http://perforce.freebsd.org/chv.cgi?CH=108432 Change 108432 by millert@millert_macbook on 2006/10/25 20:54:25 Fix for panic when unloading an unloadable policy. Affected files ... .. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/security/mac_base.c#18 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/security/mac_base.c#18 (text+ko) ==== @@ -585,6 +585,8 @@ * the policy manages from the non-static list of namespaces. * The removal only takes place when no other policy is interested in the * namespace. + * + * Must be called with the policy exclusive lock held. */ void mac_policy_removefrom_labellist(mac_policy_handle_t handle) @@ -607,9 +609,6 @@ * that label element from the list. Note that we only * have to worry about the non-static list. */ - /* XXX - how could mac_late *not* be set here?!? */ - if (mac_late) - mac_policy_grab_exclusive(); LIST_FOREACH(mle, &mac_label_element_list, mle_list) { LIST_FOREACH(mll, &mle->mle_listeners, mll_list) { if (mll->mll_handle == handle) { @@ -619,13 +618,10 @@ LIST_REMOVE(mle, mle_list); FREE(mle, M_MACTEMP); } - goto done; + return; } } } -done: - if (mac_late) - mac_policy_release_exclusive(); } /* @@ -913,6 +909,8 @@ return (EBUSY); } + mac_policy_removefrom_labellist(handle); + mac_get_mpc(handle) = NULL; if (handle < mac_policy_list.freehint && handle >= mac_policy_list.staticmax) @@ -926,7 +924,6 @@ mac_policy_release_exclusive(); - mac_policy_removefrom_labellist(handle); if (mpc->mpc_data) { struct mac_module_data *mmd = mpc->mpc_data; kfree(mmd, mmd->size);