diff options
Diffstat (limited to 'security/integrity')
-rw-r--r-- | security/integrity/ima/ima_crypto.c | 6 | ||||
-rw-r--r-- | security/integrity/ima/ima_main.c | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c index 63003a63aaee..46642a19bc78 100644 --- a/security/integrity/ima/ima_crypto.c +++ b/security/integrity/ima/ima_crypto.c | |||
@@ -45,9 +45,9 @@ int ima_calc_hash(struct file *file, char *digest) | |||
45 | { | 45 | { |
46 | struct hash_desc desc; | 46 | struct hash_desc desc; |
47 | struct scatterlist sg[1]; | 47 | struct scatterlist sg[1]; |
48 | loff_t i_size; | 48 | loff_t i_size, offset = 0; |
49 | char *rbuf; | 49 | char *rbuf; |
50 | int rc, offset = 0; | 50 | int rc; |
51 | 51 | ||
52 | rc = init_desc(&desc); | 52 | rc = init_desc(&desc); |
53 | if (rc != 0) | 53 | if (rc != 0) |
@@ -67,6 +67,8 @@ int ima_calc_hash(struct file *file, char *digest) | |||
67 | rc = rbuf_len; | 67 | rc = rbuf_len; |
68 | break; | 68 | break; |
69 | } | 69 | } |
70 | if (rbuf_len == 0) | ||
71 | break; | ||
70 | offset += rbuf_len; | 72 | offset += rbuf_len; |
71 | sg_init_one(sg, rbuf, rbuf_len); | 73 | sg_init_one(sg, rbuf, rbuf_len); |
72 | 74 | ||
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c index 101c512564ec..4732f5e5d127 100644 --- a/security/integrity/ima/ima_main.c +++ b/security/integrity/ima/ima_main.c | |||
@@ -262,6 +262,8 @@ void ima_counts_put(struct path *path, int mask) | |||
262 | else if (mask & (MAY_READ | MAY_EXEC)) | 262 | else if (mask & (MAY_READ | MAY_EXEC)) |
263 | iint->readcount--; | 263 | iint->readcount--; |
264 | mutex_unlock(&iint->mutex); | 264 | mutex_unlock(&iint->mutex); |
265 | |||
266 | kref_put(&iint->refcount, iint_free); | ||
265 | } | 267 | } |
266 | 268 | ||
267 | /* | 269 | /* |
@@ -291,6 +293,8 @@ void ima_counts_get(struct file *file) | |||
291 | if (file->f_mode & FMODE_WRITE) | 293 | if (file->f_mode & FMODE_WRITE) |
292 | iint->writecount++; | 294 | iint->writecount++; |
293 | mutex_unlock(&iint->mutex); | 295 | mutex_unlock(&iint->mutex); |
296 | |||
297 | kref_put(&iint->refcount, iint_free); | ||
294 | } | 298 | } |
295 | EXPORT_SYMBOL_GPL(ima_counts_get); | 299 | EXPORT_SYMBOL_GPL(ima_counts_get); |
296 | 300 | ||