IMA: drop refcnt from ima_iint_cache since it isn't needed
Since finding a struct ima_iint_cache requires a valid struct inode, and
the struct ima_iint_cache is supposed to have the same lifetime as a
struct inode (technically they die together but don't need to be created
at the same time) we don't have to worry about the ima_iint_cache
outliving or dieing before the inode. So the refcnt isn't useful. Just
get rid of it and free the structure when the inode is freed.
Signed-off-by: Eric Paris <eapris@redhat.com>
Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
index 5e3229c..1dccafe 100644
--- a/security/integrity/ima/ima_main.c
+++ b/security/integrity/ima/ima_main.c
@@ -186,8 +186,6 @@
spin_unlock(&inode->i_lock);
mutex_unlock(&iint->mutex);
-
- kref_put(&iint->refcount, iint_free);
}
static void ima_file_free_noiint(struct inode *inode, struct file *file)
@@ -213,7 +211,7 @@
if (!iint_initialized || !S_ISREG(inode->i_mode))
return;
- iint = ima_iint_find_get(inode);
+ iint = ima_iint_find(inode);
if (iint)
ima_file_free_iint(iint, inode, file);
@@ -236,7 +234,7 @@
if (rc != 0)
return rc;
retry:
- iint = ima_iint_find_get(inode);
+ iint = ima_iint_find(inode);
if (!iint) {
rc = ima_inode_alloc(inode);
if (!rc || rc == -EEXIST)
@@ -255,7 +253,6 @@
ima_store_measurement(iint, file, filename);
out:
mutex_unlock(&iint->mutex);
- kref_put(&iint->refcount, iint_free);
return rc;
}