Skip to content

Commit

Permalink
selinux: skip bounded transition processing if the policy isn't loaded
Browse files Browse the repository at this point in the history
We can't do anything reasonable in security_bounded_transition() if we
don't have a policy loaded, and in fact we could run into problems
with some of the code inside expecting a policy.  Fix these problems
like we do many others in security/selinux/ss/services.c by checking
to see if the policy is loaded (ss_initialized) and returning quickly
if it isn't.

Reported-by: syzbot <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
Acked-by: Stephen Smalley <[email protected]>
Reviewed-by: James Morris <[email protected]>
  • Loading branch information
pcmoore committed Dec 5, 2017
1 parent ef28df5 commit 4b14752
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions security/selinux/ss/services.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,9 @@ int security_bounded_transition(u32 old_sid, u32 new_sid)
int index;
int rc;

if (!ss_initialized)
return 0;

read_lock(&policy_rwlock);

rc = -EINVAL;
Expand Down

0 comments on commit 4b14752

Please sign in to comment.