diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c index 2591583..29994c8 100644 --- a/kernel/user_namespace.c +++ b/kernel/user_namespace.c @@ -95,11 +95,10 @@ uid_t user_ns_map_uid(struct user_namespace *to, const struct cred *cred, uid_t /* Is cred->user the creator of the target user_ns * or the creator of one of it's parents? */ - for ( tmp = to; tmp != &init_user_ns; - tmp = tmp->creator->user_ns ) { - if (cred->user == tmp->creator) { + for (tmp = to; tmp != &init_user_ns; + tmp = tmp->creator->user_ns) { + if (cred->user == tmp->creator) return (uid_t)0; - } } /* No useful relationship so no mapping */ @@ -116,11 +115,10 @@ gid_t user_ns_map_gid(struct user_namespace *to, const struct cred *cred, gid_t /* Is cred->user the creator of the target user_ns * or the creator of one of it's parents? */ - for ( tmp = to; tmp != &init_user_ns; - tmp = tmp->creator->user_ns ) { - if (cred->user == tmp->creator) { + for (tmp = to; tmp != &init_user_ns; + tmp = tmp->creator->user_ns) { + if (cred->user == tmp->creator) return (gid_t)0; - } } /* No useful relationship so no mapping */