diff options
Diffstat (limited to 'security/integrity/ima/ima_api.c')
-rw-r--r-- | security/integrity/ima/ima_api.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/security/integrity/ima/ima_api.c b/security/integrity/ima/ima_api.c index ba9e4d792dd5..d9cd5ce14d2b 100644 --- a/security/integrity/ima/ima_api.c +++ b/security/integrity/ima/ima_api.c | |||
@@ -199,6 +199,7 @@ int ima_collect_measurement(struct integrity_iint_cache *iint, | |||
199 | struct evm_ima_xattr_data **xattr_value, | 199 | struct evm_ima_xattr_data **xattr_value, |
200 | int *xattr_len) | 200 | int *xattr_len) |
201 | { | 201 | { |
202 | const char *audit_cause = "failed"; | ||
202 | struct inode *inode = file_inode(file); | 203 | struct inode *inode = file_inode(file); |
203 | const char *filename = file->f_dentry->d_name.name; | 204 | const char *filename = file->f_dentry->d_name.name; |
204 | int result = 0; | 205 | int result = 0; |
@@ -213,6 +214,12 @@ int ima_collect_measurement(struct integrity_iint_cache *iint, | |||
213 | if (!(iint->flags & IMA_COLLECTED)) { | 214 | if (!(iint->flags & IMA_COLLECTED)) { |
214 | u64 i_version = file_inode(file)->i_version; | 215 | u64 i_version = file_inode(file)->i_version; |
215 | 216 | ||
217 | if (file->f_flags & O_DIRECT) { | ||
218 | audit_cause = "failed(directio)"; | ||
219 | result = -EACCES; | ||
220 | goto out; | ||
221 | } | ||
222 | |||
216 | /* use default hash algorithm */ | 223 | /* use default hash algorithm */ |
217 | hash.hdr.algo = ima_hash_algo; | 224 | hash.hdr.algo = ima_hash_algo; |
218 | 225 | ||
@@ -233,9 +240,10 @@ int ima_collect_measurement(struct integrity_iint_cache *iint, | |||
233 | result = -ENOMEM; | 240 | result = -ENOMEM; |
234 | } | 241 | } |
235 | } | 242 | } |
243 | out: | ||
236 | if (result) | 244 | if (result) |
237 | integrity_audit_msg(AUDIT_INTEGRITY_DATA, inode, | 245 | integrity_audit_msg(AUDIT_INTEGRITY_DATA, inode, |
238 | filename, "collect_data", "failed", | 246 | filename, "collect_data", audit_cause, |
239 | result, 0); | 247 | result, 0); |
240 | return result; | 248 | return result; |
241 | } | 249 | } |