Skip to content

Commit 37b1180

Browse files
committed
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 <[email protected]> Signed-off-by: "Eric W. Biederman" <[email protected]>
1 parent a475acf commit 37b1180

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/linux/uidgid.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,12 @@ static inline gid_t from_kgid_munged(struct user_namespace *to, kgid_t kgid)
177177

178178
static inline bool kuid_has_mapping(struct user_namespace *ns, kuid_t uid)
179179
{
180-
return true;
180+
return uid_valid(uid);
181181
}
182182

183183
static inline bool kgid_has_mapping(struct user_namespace *ns, kgid_t gid)
184184
{
185-
return true;
185+
return gid_valid(gid);
186186
}
187187

188188
#endif /* CONFIG_USER_NS */

0 commit comments

Comments
 (0)