Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 217420
b: refs/heads/master
c: 196f518
h: refs/heads/master
v: v3
  • Loading branch information
Eric Paris authored and Linus Torvalds committed Oct 26, 2010
1 parent 0317308 commit d307ce2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 64c62f06bef8314a64d3189cb9c78062d54169b3
refs/heads/master: 196f518128d2ee6e0028b50e6fec0313640db142
2 changes: 2 additions & 0 deletions trunk/include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ struct inodes_stat_t {
#define S_NOCMTIME 128 /* Do not update file c/mtime */
#define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */
#define S_PRIVATE 512 /* Inode is fs-internal */
#define S_IMA 1024 /* Inode has an associated IMA struct */

/*
* Note that nosuid etc flags are inode-specific: setting some file-system
Expand Down Expand Up @@ -269,6 +270,7 @@ struct inodes_stat_t {
#define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME)
#define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE)
#define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE)
#define IS_IMA(inode) ((inode)->i_flags & S_IMA)

/* the read-only stuff doesn't really belong here, but any other place is
probably as bad and I don't want to create yet another include file. */
Expand Down
16 changes: 11 additions & 5 deletions trunk/security/integrity/ima/ima_iint.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ struct ima_iint_cache *ima_iint_find(struct inode *inode)
{
struct ima_iint_cache *iint;

if (!IS_IMA(inode))
return NULL;

spin_lock(&ima_iint_lock);
iint = __ima_iint_find(inode);
spin_unlock(&ima_iint_lock);
Expand Down Expand Up @@ -91,6 +94,7 @@ int ima_inode_alloc(struct inode *inode)
new_iint->inode = inode;
new_node = &new_iint->rb_node;

mutex_lock(&inode->i_mutex); /* i_flags */
spin_lock(&ima_iint_lock);

p = &ima_iint_tree.rb_node;
Expand All @@ -107,14 +111,17 @@ int ima_inode_alloc(struct inode *inode)
goto out_err;
}

inode->i_flags |= S_IMA;
rb_link_node(new_node, parent, p);
rb_insert_color(new_node, &ima_iint_tree);

spin_unlock(&ima_iint_lock);
mutex_unlock(&inode->i_mutex); /* i_flags */

return 0;
out_err:
spin_unlock(&ima_iint_lock);
mutex_unlock(&inode->i_mutex); /* i_flags */
iint_free(new_iint);

return rc;
Expand All @@ -135,15 +142,14 @@ void ima_inode_free(struct inode *inode)

inode->i_readcount = 0;

if (!IS_IMA(inode))
return;

spin_lock(&ima_iint_lock);
iint = __ima_iint_find(inode);
if (iint)
rb_erase(&iint->rb_node, &ima_iint_tree);
rb_erase(&iint->rb_node, &ima_iint_tree);
spin_unlock(&ima_iint_lock);

if (!iint)
return;

iint_free(iint);
}

Expand Down
1 change: 1 addition & 0 deletions trunk/security/integrity/ima/ima_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ void ima_file_free(struct file *file)

if (!iint_initialized || !S_ISREG(inode->i_mode))
return;

iint = ima_iint_find(inode);

if (iint)
Expand Down

0 comments on commit d307ce2

Please sign in to comment.