Fix: rseq: arm branch to failure
[deliverable/linux.git] / kernel / user_namespace.c
index 9bafc211930c79fac444a77f6f075a04ccc7f980..68f5942127590e23b86c375369b12a2973f1c6e7 100644 (file)
@@ -938,6 +938,20 @@ bool userns_may_setgroups(const struct user_namespace *ns)
        return allowed;
 }
 
+/*
+ * Returns true if @ns is the same namespace as or a descendant of
+ * @target_ns.
+ */
+bool current_in_userns(const struct user_namespace *target_ns)
+{
+       struct user_namespace *ns;
+       for (ns = current_user_ns(); ns; ns = ns->parent) {
+               if (ns == target_ns)
+                       return true;
+       }
+       return false;
+}
+
 static inline struct user_namespace *to_user_ns(struct ns_common *ns)
 {
        return container_of(ns, struct user_namespace, ns);
This page took 0.0241170000000001 seconds and 5 git commands to generate.