Commit 32a7b581 authored by Seth Forshee's avatar Seth Forshee

userns: Handle invalid ids consistently in k[ug]id_has_mapping()

Calling these functions with an invlid id returnse false if user
namespaces are enabled and true if they are disabled.
INVALID_[UG]ID are never included in any mapping, so fix the
CONFIG_USER_NS=n to return false for invalid ids.
Signed-off-by: default avatarSeth Forshee <seth.forshee@canonical.com>
Acked-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
parent 7f405ee4
......@@ -187,12 +187,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 */
......
Markdown is supported
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