Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 217416
b: refs/heads/master
c: b9593d3
h: refs/heads/master
v: v3
  • Loading branch information
Eric Paris authored and Linus Torvalds committed Oct 26, 2010
1 parent 2d44184 commit 9f6a9e7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 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: ad16ad00c34d3f320a5876b3d711ef6bc81362e1
refs/heads/master: b9593d309d17c57e9ddc3934d641902533896ca9
1 change: 0 additions & 1 deletion trunk/security/integrity/ima/ima.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ struct ima_iint_cache {
struct mutex mutex; /* protects: version, flags, digest */
/* protected by inode->i_lock */
unsigned int readcount; /* measured files readcount */
unsigned int writecount;/* measured files writecount */
struct kref refcount; /* ima_iint_cache reference count */
};

Expand Down
6 changes: 0 additions & 6 deletions trunk/security/integrity/ima/ima_iint.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,6 @@ void iint_free(struct kref *kref)
iint->readcount);
iint->readcount = 0;
}
if (iint->writecount != 0) {
printk(KERN_INFO "%s: writecount: %u\n", __func__,
iint->writecount);
iint->writecount = 0;
}
kref_init(&iint->refcount);
kmem_cache_free(iint_cache, iint);
}
Expand Down Expand Up @@ -166,7 +161,6 @@ static void init_once(void *foo)
iint->flags = 0UL;
mutex_init(&iint->mutex);
iint->readcount = 0;
iint->writecount = 0;
kref_init(&iint->refcount);
}

Expand Down
16 changes: 6 additions & 10 deletions trunk/security/integrity/ima/ima_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ static void ima_inc_counts(struct ima_iint_cache *iint, fmode_t mode)

if ((mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ)
iint->readcount++;
if (mode & FMODE_WRITE)
iint->writecount++;
}

/*
Expand Down Expand Up @@ -173,18 +171,16 @@ static void ima_dec_counts(struct ima_iint_cache *iint, struct inode *inode,
iint->readcount--;
}
if (mode & FMODE_WRITE) {
if (unlikely(iint->writecount == 0))
if (atomic_read(&inode->i_writecount) <= 0)
dump = true;
iint->writecount--;
if (iint->writecount == 0) {
if (iint->version != inode->i_version)
iint->flags &= ~IMA_MEASURED;
}
if (atomic_read(&inode->i_writecount) == 1 &&
iint->version != inode->i_version)
iint->flags &= ~IMA_MEASURED;
}

if (dump && !ima_limit_imbalance(file)) {
printk(KERN_INFO "%s: open/free imbalance (r:%u w:%u)\n",
__func__, iint->readcount, iint->writecount);
printk(KERN_INFO "%s: open/free imbalance (r:%u)\n",
__func__, iint->readcount);
dump_stack();
}
}
Expand Down

0 comments on commit 9f6a9e7

Please sign in to comment.