Skip to content

Commit

Permalink
SELinux: reset the security_ops before flushing the avc cache
Browse files Browse the repository at this point in the history
This patch resets the security_ops to the secondary_ops before it flushes
the avc.  It's still possible that a task on another processor could have
already passed the security_ops dereference and be executing an selinux hook
function which would add a new avc entry.  That entry would still not be
freed.  This should however help to reduce the number of needless avcs the
kernel has when selinux is disabled at run time.  There is no wasted
memory if selinux is disabled on the command line or not compiled.

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
  • Loading branch information
Eric Paris authored and James Morris committed Sep 30, 2009
1 parent 1669b04 commit af8ff04
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -5830,12 +5830,12 @@ 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;

/* Try to destroy the avc node cache */
avc_disable();

/* Unregister netfilter hooks. */
selinux_nf_ip_exit();

Expand Down

0 comments on commit af8ff04

Please sign in to comment.