aboutsummaryrefslogtreecommitdiffstats
path: root/security/commoncap.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/commoncap.c')
-rw-r--r--security/commoncap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/security/commoncap.c b/security/commoncap.c
index 435d074853f3..f2399d8afbe0 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -76,8 +76,9 @@ int cap_capable(const struct cred *cred, struct user_namespace *targ_ns,
76 int cap, int audit) 76 int cap, int audit)
77{ 77{
78 for (;;) { 78 for (;;) {
79 /* The creator of the user namespace has all caps. */ 79 /* The owner of the user namespace has all caps. */
80 if (targ_ns != &init_user_ns && targ_ns->creator == cred->user) 80 if (targ_ns != &init_user_ns && uid_eq(targ_ns->owner,
81 make_kuid(cred->user_ns, cred->euid)))
81 return 0; 82 return 0;
82 83
83 /* Do we have the necessary capabilities? */ 84 /* Do we have the necessary capabilities? */