]> git.baikalelectronics.ru Git - kernel.git/commitdiff
apparmor: Replace spin_is_locked() with lockdep
authorLance Roy <ldr709@gmail.com>
Wed, 3 Oct 2018 05:39:01 +0000 (22:39 -0700)
committerJohn Johansen <john.johansen@canonical.com>
Wed, 3 Oct 2018 13:29:22 +0000 (06:29 -0700)
lockdep_assert_held() is better suited to checking locking requirements,
since it won't get confused when someone else holds the lock. This is
also a step towards possibly removing spin_is_locked().

Signed-off-by: Lance Roy <ldr709@gmail.com>
Cc: John Johansen <john.johansen@canonical.com>
Cc: James Morris <jmorris@namei.org>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: <linux-security-module@vger.kernel.org>
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/file.c

index 4285943f7260f36f271b7d7ad773345fb84d97f0..d0afed9ebd0ed9cac3a4803f6f1622959802c9d9 100644 (file)
@@ -496,7 +496,7 @@ static void update_file_ctx(struct aa_file_ctx *fctx, struct aa_label *label,
        /* update caching of label on file_ctx */
        spin_lock(&fctx->lock);
        old = rcu_dereference_protected(fctx->label,
-                                       spin_is_locked(&fctx->lock));
+                                       lockdep_is_held(&fctx->lock));
        l = aa_label_merge(old, label, GFP_ATOMIC);
        if (l) {
                if (l != old) {