aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
Diffstat (limited to 'security')
-rw-r--r--security/selinux/avc.c6
-rw-r--r--security/selinux/hooks.c3
-rw-r--r--security/selinux/include/avc.h3
3 files changed, 12 insertions, 0 deletions
diff --git a/security/selinux/avc.c b/security/selinux/avc.c
index 7823e84dbe8d..236aaa2ea86d 100644
--- a/security/selinux/avc.c
+++ b/security/selinux/avc.c
@@ -970,3 +970,9 @@ u32 avc_policy_seqno(void)
970{ 970{
971 return avc_cache.latest_notif; 971 return avc_cache.latest_notif;
972} 972}
973
974void avc_disable(void)
975{
976 if (avc_node_cachep)
977 kmem_cache_destroy(avc_node_cachep);
978}
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index e3b4f3083dd7..2081055f6783 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -5683,6 +5683,9 @@ int selinux_disable(void)
5683 selinux_disabled = 1; 5683 selinux_disabled = 1;
5684 selinux_enabled = 0; 5684 selinux_enabled = 0;
5685 5685
5686 /* Try to destroy the avc node cache */
5687 avc_disable();
5688
5686 /* Reset security_ops to the secondary module, dummy or capability. */ 5689 /* Reset security_ops to the secondary module, dummy or capability. */
5687 security_ops = secondary_ops; 5690 security_ops = secondary_ops;
5688 5691
diff --git a/security/selinux/include/avc.h b/security/selinux/include/avc.h
index 46a940d9af67..ae4c3a0e2c1a 100644
--- a/security/selinux/include/avc.h
+++ b/security/selinux/include/avc.h
@@ -131,6 +131,9 @@ int avc_add_callback(int (*callback)(u32 event, u32 ssid, u32 tsid,
131int avc_get_hash_stats(char *page); 131int avc_get_hash_stats(char *page);
132extern unsigned int avc_cache_threshold; 132extern unsigned int avc_cache_threshold;
133 133
134/* Attempt to free avc node cache */
135void avc_disable(void);
136
134#ifdef CONFIG_SECURITY_SELINUX_AVC_STATS 137#ifdef CONFIG_SECURITY_SELINUX_AVC_STATS
135DECLARE_PER_CPU(struct avc_cache_stats, avc_cache_stats); 138DECLARE_PER_CPU(struct avc_cache_stats, avc_cache_stats);
136#endif 139#endif