userns: Check uid_map's opener's fsuid, not the current fsuid
authorAndy Lutomirski <luto@amacapital.net>
Sun, 14 Apr 2013 23:28:19 +0000 (16:28 -0700)
committerAndy Lutomirski <luto@amacapital.net>
Mon, 15 Apr 2013 01:11:31 +0000 (18:11 -0700)
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
kernel/user_namespace.c

index e2d4ace4481bb0a277d45d1789082b28b74c3bae..5c16f3aa757a0353f8d7621b6b9d16cd586b347e 100644 (file)
@@ -797,12 +797,12 @@ static bool new_idmap_permitted(const struct file *file,
                u32 id = new_map->extent[0].lower_first;
                if (cap_setid == CAP_SETUID) {
                        kuid_t uid = make_kuid(ns->parent, id);
-                       if (uid_eq(uid, current_fsuid()))
+                       if (uid_eq(uid, file->f_cred->fsuid))
                                return true;
                }
                else if (cap_setid == CAP_SETGID) {
                        kgid_t gid = make_kgid(ns->parent, id);
-                       if (gid_eq(gid, current_fsgid()))
+                       if (gid_eq(gid, file->f_cred->fsgid))
                                return true;
                }
        }