diff options
author | Huaxin Lu <luhuaxin1@huawei.com> | 2022-07-05 13:14:17 +0800 |
---|---|---|
committer | Mimi Zohar <zohar@linux.ibm.com> | 2022-07-07 11:50:25 -0400 |
commit | d2ee2cfc4aa85ff6a2a3b198a3a524ec54e3d999 (patch) | |
tree | ad8e9b56f6e5c2ee0eb161ecf29deaf1454e340c /security/integrity | |
parent | 9fab303a2cb3d323ca3a32a8b4ab60b451141901 (diff) |
ima: Fix a potential integer overflow in ima_appraise_measurement
When the ima-modsig is enabled, the rc passed to evm_verifyxattr() may be
negative, which may cause the integer overflow problem.
Fixes: 39b07096364a ("ima: Implement support for module-style appended signatures")
Signed-off-by: Huaxin Lu <luhuaxin1@huawei.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Diffstat (limited to 'security/integrity')
-rw-r--r-- | security/integrity/ima/ima_appraise.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index cdb84dccd24e..bde74fcecee3 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c @@ -514,7 +514,8 @@ int ima_appraise_measurement(enum ima_hooks func, goto out; } - status = evm_verifyxattr(dentry, XATTR_NAME_IMA, xattr_value, rc, iint); + status = evm_verifyxattr(dentry, XATTR_NAME_IMA, xattr_value, + rc < 0 ? 0 : rc, iint); switch (status) { case INTEGRITY_PASS: case INTEGRITY_PASS_IMMUTABLE: |