rk: revert to v3.10
[firefly-linux-kernel-4.4.55.git] / kernel / groups.c
index 67b4ba30475fbc2b902e5a6226aeac2d2aaa5803..6b2588dd04ff20fb89995394f9c530a2613fbb83 100644 (file)
@@ -6,7 +6,6 @@
 #include <linux/slab.h>
 #include <linux/security.h>
 #include <linux/syscalls.h>
-#include <linux/user_namespace.h>
 #include <asm/uaccess.h>
 
 /* init to 2 - one for init_task, one to ensure it is never freed */
@@ -224,14 +223,6 @@ out:
        return i;
 }
 
-bool may_setgroups(void)
-{
-       struct user_namespace *user_ns = current_user_ns();
-
-       return ns_capable(user_ns, CAP_SETGID) &&
-               userns_may_setgroups(user_ns);
-}
-
 /*
  *     SMP: Our groups are copy-on-write. We can set them safely
  *     without another task interfering.
@@ -242,7 +233,7 @@ SYSCALL_DEFINE2(setgroups, int, gidsetsize, gid_t __user *, grouplist)
        struct group_info *group_info;
        int retval;
 
-       if (!may_setgroups())
+       if (!nsown_capable(CAP_SETGID))
                return -EPERM;
        if ((unsigned)gidsetsize > NGROUPS_MAX)
                return -EINVAL;