apparmor: fix introspection of of task mode for unconfined tasks
[linux-2.6-microblaze.git] / security / apparmor / label.c
index 676eebc..23f7a19 100644 (file)
@@ -1558,13 +1558,13 @@ static const char *label_modename(struct aa_ns *ns, struct aa_label *label,
 
        label_for_each(i, label, profile) {
                if (aa_ns_visible(ns, profile->ns, flags & FLAG_VIEW_SUBNS)) {
-                       if (profile->mode == APPARMOR_UNCONFINED)
+                       count++;
+                       if (profile == profile->ns->unconfined)
                                /* special case unconfined so stacks with
                                 * unconfined don't report as mixed. ie.
                                 * profile_foo//&:ns1:unconfined (mixed)
                                 */
                                continue;
-                       count++;
                        if (mode == -1)
                                mode = profile->mode;
                        else if (mode != profile->mode)