diff options
| -rw-r--r-- | security/integrity/ima/ima_appraise.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index 291bf0f3a46d..d3113d4aaa3c 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c | |||
| @@ -341,7 +341,7 @@ static int ima_protect_xattr(struct dentry *dentry, const char *xattr_name, | |||
| 341 | return 0; | 341 | return 0; |
| 342 | } | 342 | } |
| 343 | 343 | ||
| 344 | static void ima_reset_appraise_flags(struct inode *inode) | 344 | static void ima_reset_appraise_flags(struct inode *inode, int digsig) |
| 345 | { | 345 | { |
| 346 | struct integrity_iint_cache *iint; | 346 | struct integrity_iint_cache *iint; |
| 347 | 347 | ||
| @@ -353,18 +353,22 @@ static void ima_reset_appraise_flags(struct inode *inode) | |||
| 353 | return; | 353 | return; |
| 354 | 354 | ||
| 355 | iint->flags &= ~IMA_DONE_MASK; | 355 | iint->flags &= ~IMA_DONE_MASK; |
| 356 | if (digsig) | ||
| 357 | iint->flags |= IMA_DIGSIG; | ||
| 356 | return; | 358 | return; |
| 357 | } | 359 | } |
| 358 | 360 | ||
| 359 | int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name, | 361 | int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name, |
| 360 | const void *xattr_value, size_t xattr_value_len) | 362 | const void *xattr_value, size_t xattr_value_len) |
| 361 | { | 363 | { |
| 364 | const struct evm_ima_xattr_data *xvalue = xattr_value; | ||
| 362 | int result; | 365 | int result; |
| 363 | 366 | ||
| 364 | result = ima_protect_xattr(dentry, xattr_name, xattr_value, | 367 | result = ima_protect_xattr(dentry, xattr_name, xattr_value, |
| 365 | xattr_value_len); | 368 | xattr_value_len); |
| 366 | if (result == 1) { | 369 | if (result == 1) { |
| 367 | ima_reset_appraise_flags(dentry->d_inode); | 370 | ima_reset_appraise_flags(dentry->d_inode, |
| 371 | (xvalue->type == EVM_IMA_XATTR_DIGSIG) ? 1 : 0); | ||
| 368 | result = 0; | 372 | result = 0; |
| 369 | } | 373 | } |
| 370 | return result; | 374 | return result; |
| @@ -376,7 +380,7 @@ int ima_inode_removexattr(struct dentry *dentry, const char *xattr_name) | |||
| 376 | 380 | ||
| 377 | result = ima_protect_xattr(dentry, xattr_name, NULL, 0); | 381 | result = ima_protect_xattr(dentry, xattr_name, NULL, 0); |
| 378 | if (result == 1) { | 382 | if (result == 1) { |
| 379 | ima_reset_appraise_flags(dentry->d_inode); | 383 | ima_reset_appraise_flags(dentry->d_inode, 0); |
| 380 | result = 0; | 384 | result = 0; |
| 381 | } | 385 | } |
| 382 | return result; | 386 | return result; |
