Merge tag 'apparmor-pr-2017-11-21' of git://git.kernel.org/pub/scm/linux/kernel/git...
[muen/linux.git] / security / apparmor / label.c
index f5df9eaba4df4058d04b228c0692b42dd28dfd41..324fe5c60f8781c952138d0a764a5c2223f6353b 100644 (file)
@@ -80,7 +80,7 @@ void __aa_proxy_redirect(struct aa_label *orig, struct aa_label *new)
 
        AA_BUG(!orig);
        AA_BUG(!new);
-       AA_BUG(!write_is_locked(&labels_set(orig)->lock));
+       lockdep_assert_held_exclusive(&labels_set(orig)->lock);
 
        tmp = rcu_dereference_protected(orig->proxy->label,
                                        &labels_ns(orig)->lock);
@@ -571,7 +571,7 @@ static bool __label_remove(struct aa_label *label, struct aa_label *new)
 
        AA_BUG(!ls);
        AA_BUG(!label);
-       AA_BUG(!write_is_locked(&ls->lock));
+       lockdep_assert_held_exclusive(&ls->lock);
 
        if (new)
                __aa_proxy_redirect(label, new);
@@ -608,7 +608,7 @@ static bool __label_replace(struct aa_label *old, struct aa_label *new)
        AA_BUG(!ls);
        AA_BUG(!old);
        AA_BUG(!new);
-       AA_BUG(!write_is_locked(&ls->lock));
+       lockdep_assert_held_exclusive(&ls->lock);
        AA_BUG(new->flags & FLAG_IN_TREE);
 
        if (!label_is_stale(old))
@@ -645,7 +645,7 @@ static struct aa_label *__label_insert(struct aa_labelset *ls,
        AA_BUG(!ls);
        AA_BUG(!label);
        AA_BUG(labels_set(label) != ls);
-       AA_BUG(!write_is_locked(&ls->lock));
+       lockdep_assert_held_exclusive(&ls->lock);
        AA_BUG(label->flags & FLAG_IN_TREE);
 
        /* Figure out where to put new node */