summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorHuaxin Lu <luhuaxin1@huawei.com>2022-07-05 13:14:17 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-07-21 21:20:04 +0200
commit831e190175f10652be93b08436cc7bf2e62e4bb6 (patch)
tree317b964e864f5fd12e0ad422faef8ebbb97715dd /security
parent592f3bad00b7e2a95a6fb7a4f9e742c061c9c3c1 (diff)
ima: Fix a potential integer overflow in ima_appraise_measurement
[ Upstream commit d2ee2cfc4aa85ff6a2a3b198a3a524ec54e3d999 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'security')
-rw-r--r--security/integrity/ima/ima_appraise.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c
index 3dd8c2e4314e..7122a359a268 100644
--- a/security/integrity/ima/ima_appraise.c
+++ b/security/integrity/ima/ima_appraise.c
@@ -396,7 +396,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: