The function inode_cmp_iversion{+raw} is counter-intuitive, because it returns true when the counters are different and false when these are equal. Rename it to inode_eq_iversion{+raw}, which will returns true when the counters are equal and false otherwise.
Showing the changes to security (1 of 11 files). Show all
Unified · Split
| @@ -135,7 +135,7 @@ static void ima_check_last_writer(struct integrity_iint_cache *iint, · 134 unmodified lines | |||
| 135 | update = test_and_clear_bit(IMA_UPDATE_XATTR, | 135 | update = test_and_clear_bit(IMA_UPDATE_XATTR, |
| 136 | &iint->atomic_flags); | 136 | &iint->atomic_flags); |
| 137 | if (!IS_I_VERSION(inode) || | 137 | if (!IS_I_VERSION(inode) || |
| 138 | inode_cmp_iversion(inode, iint->version) || | 138 | !inode_eq_iversion(inode, iint->version) || |
| 139 | (iint->flags & IMA_NEW_FILE)) { | 139 | (iint->flags & IMA_NEW_FILE)) { |
| 140 | iint->flags &= ~(IMA_DONE_MASK | IMA_NEW_FILE); | 140 | iint->flags &= ~(IMA_DONE_MASK | IMA_NEW_FILE); |
| 141 | iint->measured_pcrs = 0; | 141 | iint->measured_pcrs = 0; |