summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2016-06-27 15:52:48 -0500
committerEric W. Biederman <ebiederm@xmission.com>2016-06-30 18:04:36 -0500
commit37b11804ed1725dc2ea97be2236150210a69e9d5 (patch)
treecc8feef112a36a4b9e10ac60d673000f7de3716a
parenta475acf01f79e89a1a5845733e10108d80f77188 (diff)
downloadlinux-37b11804ed1725dc2ea97be2236150210a69e9d5.tar.bz2
userns: Handle -1 in k[ug]id_has_mapping when !CONFIG_USER_NS
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 <seth.forshee@canonical.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
-rw-r--r--include/linux/uidgid.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/uidgid.h b/include/linux/uidgid.h
index 03835522dfcb..25e9d9216340 100644
--- a/include/linux/uidgid.h
+++ b/include/linux/uidgid.h
@@ -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 */