Skip to content

Commit

Permalink
userns: Handle -1 in k[ug]id_has_mapping when !CONFIG_USER_NS
Browse files Browse the repository at this point in the history
Refuse to admit any user namespace has a mapping of the INVALID_UID
and the INVALID_GID when !CONFIG_USER_NS.

Acked-by: Seth Forshee <[email protected]>
Signed-off-by: "Eric W. Biederman" <[email protected]>
  • Loading branch information
ebiederm committed Jun 30, 2016
1 parent a475acf commit 37b1180
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/linux/uidgid.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ static inline gid_t from_kgid_munged(struct user_namespace *to, kgid_t kgid)

static inline bool kuid_has_mapping(struct user_namespace *ns, kuid_t uid)
{
return true;
return uid_valid(uid);
}

static inline bool kgid_has_mapping(struct user_namespace *ns, kgid_t gid)
{
return true;
return gid_valid(gid);
}

#endif /* CONFIG_USER_NS */
Expand Down

0 comments on commit 37b1180

Please sign in to comment.