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 */
};
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);
}
iint->flags = 0UL;
mutex_init(&iint->mutex);
iint->readcount = 0;
- iint->writecount = 0;
kref_init(&iint->refcount);
}
if ((mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ)
iint->readcount++;
- if (mode & FMODE_WRITE)
- iint->writecount++;
}
/*
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();
}
}