integrity: ima iint radix_tree_lookup locking fix
authorMimi Zohar <zohar@linux.vnet.ibm.com>
Fri, 20 Feb 2009 22:28:29 +0000 (14:28 -0800)
committerJames Morris <jmorris@namei.org>
Sun, 22 Feb 2009 22:54:53 +0000 (09:54 +1100)
Based on Andrew Morton's comments:
- add missing locks around radix_tree_lookup in ima_iint_insert()

Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Cc: James Morris <jmorris@namei.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Morris <jmorris@namei.org>
security/integrity/ima/ima_iint.c

index 1f035e8d29c7affa6045e3ea3de29f13a5345464..ec79f1ee992cb94c9362bc28f160633978c8c2d3 100644 (file)
@@ -73,8 +73,10 @@ out:
        if (rc < 0) {
                kmem_cache_free(iint_cache, iint);
                if (rc == -EEXIST) {
+                       spin_lock(&ima_iint_lock);
                        iint = radix_tree_lookup(&ima_iint_store,
                                                 (unsigned long)inode);
+                       spin_unlock(&ima_iint_lock);
                } else
                        iint = NULL;
        }