diff options
Diffstat (limited to 'security/integrity/ima/ima_appraise.c')
-rw-r--r-- | security/integrity/ima/ima_appraise.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index 86bfd5c5df85..013ec3f0e42d 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c | |||
@@ -183,7 +183,7 @@ int ima_read_xattr(struct dentry *dentry, | |||
183 | int ima_appraise_measurement(int func, struct integrity_iint_cache *iint, | 183 | int ima_appraise_measurement(int func, struct integrity_iint_cache *iint, |
184 | struct file *file, const unsigned char *filename, | 184 | struct file *file, const unsigned char *filename, |
185 | struct evm_ima_xattr_data *xattr_value, | 185 | struct evm_ima_xattr_data *xattr_value, |
186 | int xattr_len) | 186 | int xattr_len, int opened) |
187 | { | 187 | { |
188 | static const char op[] = "appraise_data"; | 188 | static const char op[] = "appraise_data"; |
189 | char *cause = "unknown"; | 189 | char *cause = "unknown"; |
@@ -192,8 +192,6 @@ int ima_appraise_measurement(int func, struct integrity_iint_cache *iint, | |||
192 | enum integrity_status status = INTEGRITY_UNKNOWN; | 192 | enum integrity_status status = INTEGRITY_UNKNOWN; |
193 | int rc = xattr_len, hash_start = 0; | 193 | int rc = xattr_len, hash_start = 0; |
194 | 194 | ||
195 | if (!ima_appraise) | ||
196 | return 0; | ||
197 | if (!inode->i_op->getxattr) | 195 | if (!inode->i_op->getxattr) |
198 | return INTEGRITY_UNKNOWN; | 196 | return INTEGRITY_UNKNOWN; |
199 | 197 | ||
@@ -202,8 +200,11 @@ int ima_appraise_measurement(int func, struct integrity_iint_cache *iint, | |||
202 | goto out; | 200 | goto out; |
203 | 201 | ||
204 | cause = "missing-hash"; | 202 | cause = "missing-hash"; |
205 | status = | 203 | status = INTEGRITY_NOLABEL; |
206 | (inode->i_size == 0) ? INTEGRITY_PASS : INTEGRITY_NOLABEL; | 204 | if (opened & FILE_CREATED) { |
205 | iint->flags |= IMA_NEW_FILE; | ||
206 | status = INTEGRITY_PASS; | ||
207 | } | ||
207 | goto out; | 208 | goto out; |
208 | } | 209 | } |
209 | 210 | ||