ima: only insert at inode creation time

iints are supposed to be allocated when an inode is allocated (during
security_inode_alloc())  But we have code which will attempt to allocate
an iint during measurement calls.  If we couldn't allocate the iint and we
cared, we should have died during security_inode_alloc().  Not make the
code more complex and less efficient.

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Eric Paris
2009-12-04 15:47:52 -05:00
committed by Al Viro
parent ec29ea544b
commit 9353384ec8
3 changed files with 15 additions and 67 deletions

View File

@@ -161,7 +161,7 @@ int ima_path_check(struct path *path, int mask, int update_counts)
if (!ima_initialized || !S_ISREG(inode->i_mode))
return 0;
iint = ima_iint_find_insert_get(inode);
iint = ima_iint_find_get(inode);
if (!iint)
return 0;
@@ -219,7 +219,7 @@ static int process_measurement(struct file *file, const unsigned char *filename,
if (!ima_initialized || !S_ISREG(inode->i_mode))
return 0;
iint = ima_iint_find_insert_get(inode);
iint = ima_iint_find_get(inode);
if (!iint)
return -ENOMEM;
@@ -255,7 +255,7 @@ void ima_counts_put(struct path *path, int mask)
*/
if (!ima_initialized || !inode || !S_ISREG(inode->i_mode))
return;
iint = ima_iint_find_insert_get(inode);
iint = ima_iint_find_get(inode);
if (!iint)
return;
@@ -286,7 +286,7 @@ void ima_counts_get(struct file *file)
if (!ima_initialized || !S_ISREG(inode->i_mode))
return;
iint = ima_iint_find_insert_get(inode);
iint = ima_iint_find_get(inode);
if (!iint)
return;
mutex_lock(&iint->mutex);