From 010765b0b885648a069ade982240ec6f6d17986c Mon Sep 17 00:00:00 2001 From: Thomas Liu Date: Wed, 24 Jun 2009 17:58:05 -0400 Subject: [PATCH] --- yaml --- r: 157303 b: refs/heads/master c: 89c86576ecde504da1eeb4f4882b2189ac2f9c4a h: refs/heads/master i: 157301: 31eb435089906cd3e12b785abe7da33cbc1979ba 157299: 7a54cb9ce0c906d2ede940cfef5ce8af76de8fdd 157295: fa4b475b8633b02aaea44b5c473d1aacc348be82 v: v3 --- [refs] | 2 +- trunk/security/selinux/avc.c | 6 ++++++ trunk/security/selinux/hooks.c | 3 +++ trunk/security/selinux/include/avc.h | 3 +++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index f023d262a1b1..8f3fc9f7e55e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a893a84e8799270fbec5c3708d001650aab47138 +refs/heads/master: 89c86576ecde504da1eeb4f4882b2189ac2f9c4a diff --git a/trunk/security/selinux/avc.c b/trunk/security/selinux/avc.c index 7823e84dbe8d..236aaa2ea86d 100644 --- a/trunk/security/selinux/avc.c +++ b/trunk/security/selinux/avc.c @@ -970,3 +970,9 @@ u32 avc_policy_seqno(void) { return avc_cache.latest_notif; } + +void avc_disable(void) +{ + if (avc_node_cachep) + kmem_cache_destroy(avc_node_cachep); +} diff --git a/trunk/security/selinux/hooks.c b/trunk/security/selinux/hooks.c index e3b4f3083dd7..2081055f6783 100644 --- a/trunk/security/selinux/hooks.c +++ b/trunk/security/selinux/hooks.c @@ -5683,6 +5683,9 @@ int selinux_disable(void) selinux_disabled = 1; selinux_enabled = 0; + /* Try to destroy the avc node cache */ + avc_disable(); + /* Reset security_ops to the secondary module, dummy or capability. */ security_ops = secondary_ops; diff --git a/trunk/security/selinux/include/avc.h b/trunk/security/selinux/include/avc.h index 46a940d9af67..ae4c3a0e2c1a 100644 --- a/trunk/security/selinux/include/avc.h +++ b/trunk/security/selinux/include/avc.h @@ -131,6 +131,9 @@ int avc_add_callback(int (*callback)(u32 event, u32 ssid, u32 tsid, int avc_get_hash_stats(char *page); extern unsigned int avc_cache_threshold; +/* Attempt to free avc node cache */ +void avc_disable(void); + #ifdef CONFIG_SECURITY_SELINUX_AVC_STATS DECLARE_PER_CPU(struct avc_cache_stats, avc_cache_stats); #endif