aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
Diffstat (limited to 'security')
-rw-r--r--security/integrity/ima/ima.h1
-rw-r--r--security/integrity/ima/ima_iint.c6
-rw-r--r--security/integrity/ima/ima_main.c10
3 files changed, 3 insertions, 14 deletions
diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h
index 7557791e954d..3d701084eac6 100644
--- a/security/integrity/ima/ima.h
+++ b/security/integrity/ima/ima.h
@@ -108,7 +108,6 @@ struct ima_iint_cache {
108 struct mutex mutex; /* protects: version, flags, digest */ 108 struct mutex mutex; /* protects: version, flags, digest */
109 long readcount; /* measured files readcount */ 109 long readcount; /* measured files readcount */
110 long writecount; /* measured files writecount */ 110 long writecount; /* measured files writecount */
111 long opencount; /* opens reference count */
112 struct kref refcount; /* ima_iint_cache reference count */ 111 struct kref refcount; /* ima_iint_cache reference count */
113}; 112};
114 113
diff --git a/security/integrity/ima/ima_iint.c b/security/integrity/ima/ima_iint.c
index 8395f0f5e9b9..8e64313ed182 100644
--- a/security/integrity/ima/ima_iint.c
+++ b/security/integrity/ima/ima_iint.c
@@ -134,11 +134,6 @@ void iint_free(struct kref *kref)
134 iint->writecount); 134 iint->writecount);
135 iint->writecount = 0; 135 iint->writecount = 0;
136 } 136 }
137 if (iint->opencount != 0) {
138 printk(KERN_INFO "%s: opencount: %ld\n", __func__,
139 iint->opencount);
140 iint->opencount = 0;
141 }
142 kref_init(&iint->refcount); 137 kref_init(&iint->refcount);
143 kmem_cache_free(iint_cache, iint); 138 kmem_cache_free(iint_cache, iint);
144} 139}
@@ -172,7 +167,6 @@ static void init_once(void *foo)
172 mutex_init(&iint->mutex); 167 mutex_init(&iint->mutex);
173 iint->readcount = 0; 168 iint->readcount = 0;
174 iint->writecount = 0; 169 iint->writecount = 0;
175 iint->opencount = 0;
176 kref_init(&iint->refcount); 170 kref_init(&iint->refcount);
177} 171}
178 172
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
index e662b89d4079..995bd1b98fa8 100644
--- a/security/integrity/ima/ima_main.c
+++ b/security/integrity/ima/ima_main.c
@@ -122,7 +122,6 @@ static void ima_inc_counts(struct ima_iint_cache *iint, fmode_t mode)
122{ 122{
123 BUG_ON(!mutex_is_locked(&iint->mutex)); 123 BUG_ON(!mutex_is_locked(&iint->mutex));
124 124
125 iint->opencount++;
126 if ((mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) 125 if ((mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ)
127 iint->readcount++; 126 iint->readcount++;
128 if (mode & FMODE_WRITE) 127 if (mode & FMODE_WRITE)
@@ -181,7 +180,6 @@ static void ima_dec_counts(struct ima_iint_cache *iint, struct inode *inode,
181 mode_t mode = file->f_mode; 180 mode_t mode = file->f_mode;
182 BUG_ON(!mutex_is_locked(&iint->mutex)); 181 BUG_ON(!mutex_is_locked(&iint->mutex));
183 182
184 iint->opencount--;
185 if ((mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) 183 if ((mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ)
186 iint->readcount--; 184 iint->readcount--;
187 if (mode & FMODE_WRITE) { 185 if (mode & FMODE_WRITE) {
@@ -192,13 +190,11 @@ static void ima_dec_counts(struct ima_iint_cache *iint, struct inode *inode,
192 } 190 }
193 } 191 }
194 192
195 if (((iint->opencount < 0) || 193 if (((iint->readcount < 0) ||
196 (iint->readcount < 0) ||
197 (iint->writecount < 0)) && 194 (iint->writecount < 0)) &&
198 !ima_limit_imbalance(file)) { 195 !ima_limit_imbalance(file)) {
199 printk(KERN_INFO "%s: open/free imbalance (r:%ld w:%ld o:%ld)\n", 196 printk(KERN_INFO "%s: open/free imbalance (r:%ld w:%ld)\n",
200 __func__, iint->readcount, iint->writecount, 197 __func__, iint->readcount, iint->writecount);
201 iint->opencount);
202 dump_stack(); 198 dump_stack();
203 } 199 }
204} 200}