struct mutex mutex; /* protects: version, flags, digest */
long readcount; /* measured files readcount */
long writecount; /* measured files writecount */
- long opencount; /* opens reference count */
struct kref refcount; /* ima_iint_cache reference count */
};
iint->writecount);
iint->writecount = 0;
}
- if (iint->opencount != 0) {
- printk(KERN_INFO "%s: opencount: %ld\n", __func__,
- iint->opencount);
- iint->opencount = 0;
- }
kref_init(&iint->refcount);
kmem_cache_free(iint_cache, iint);
}
mutex_init(&iint->mutex);
iint->readcount = 0;
iint->writecount = 0;
- iint->opencount = 0;
kref_init(&iint->refcount);
}
{
BUG_ON(!mutex_is_locked(&iint->mutex));
- iint->opencount++;
if ((mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ)
iint->readcount++;
if (mode & FMODE_WRITE)
mode_t mode = file->f_mode;
BUG_ON(!mutex_is_locked(&iint->mutex));
- iint->opencount--;
if ((mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ)
iint->readcount--;
if (mode & FMODE_WRITE) {
}
}
- if (((iint->opencount < 0) ||
- (iint->readcount < 0) ||
+ if (((iint->readcount < 0) ||
(iint->writecount < 0)) &&
!ima_limit_imbalance(file)) {
- printk(KERN_INFO "%s: open/free imbalance (r:%ld w:%ld o:%ld)\n",
- __func__, iint->readcount, iint->writecount,
- iint->opencount);
+ printk(KERN_INFO "%s: open/free imbalance (r:%ld w:%ld)\n",
+ __func__, iint->readcount, iint->writecount);
dump_stack();
}
}