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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user