aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/user_namespace.c
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@amacapital.net>2013-04-14 19:28:19 -0400
committerAndy Lutomirski <luto@amacapital.net>2013-04-14 21:11:31 -0400
commite3211c120a85b792978bcb4be7b2886df18d27f0 (patch)
tree6828a385e00925ad5699ad8ca365c6e7311416fc /kernel/user_namespace.c
parent6708075f104c3c9b04b23336bb0366ca30c3931b (diff)
userns: Check uid_map's opener's fsuid, not the current fsuid
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Diffstat (limited to 'kernel/user_namespace.c')
-rw-r--r--kernel/user_namespace.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index e2d4ace4481b..5c16f3aa757a 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -797,12 +797,12 @@ static bool new_idmap_permitted(const struct file *file,
797 u32 id = new_map->extent[0].lower_first; 797 u32 id = new_map->extent[0].lower_first;
798 if (cap_setid == CAP_SETUID) { 798 if (cap_setid == CAP_SETUID) {
799 kuid_t uid = make_kuid(ns->parent, id); 799 kuid_t uid = make_kuid(ns->parent, id);
800 if (uid_eq(uid, current_fsuid())) 800 if (uid_eq(uid, file->f_cred->fsuid))
801 return true; 801 return true;
802 } 802 }
803 else if (cap_setid == CAP_SETGID) { 803 else if (cap_setid == CAP_SETGID) {
804 kgid_t gid = make_kgid(ns->parent, id); 804 kgid_t gid = make_kgid(ns->parent, id);
805 if (gid_eq(gid, current_fsgid())) 805 if (gid_eq(gid, file->f_cred->fsgid))
806 return true; 806 return true;
807 } 807 }
808 } 808 }