Skip to content
Commit 64db4c7f authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Eric W. Biederman
Browse files

security: Use user_namespace::level to avoid redundant iterations in cap_capable()



When ns->level is not larger then cred->user_ns->level,
then ns can't be cred->user_ns's descendant, and
there is no a sense to search in parents.

So, break the cycle earlier and skip needless iterations.

v2: Change comment on suggested by Andy Lutomirski.

Signed-off-by: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
parent a2b42626
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment