Skip to content

Commit 0c4395f

Browse files
robertosassumimizohar
authored andcommitted
evm: Fix possible memory leak in evm_calc_hmac_or_hash()
Don't immediately return if the signature is portable and security.ima is not present. Just set error so that memory allocated is freed before returning from evm_calc_hmac_or_hash(). Fixes: 50b9774 ("EVM: Add support for portable signature format") Signed-off-by: Roberto Sassu <[email protected]> Cc: [email protected] Signed-off-by: Mimi Zohar <[email protected]>
1 parent b59fda4 commit 0c4395f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

security/integrity/evm/evm_crypto.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ static int evm_calc_hmac_or_hash(struct dentry *dentry,
241241

242242
/* Portable EVM signatures must include an IMA hash */
243243
if (type == EVM_XATTR_PORTABLE_DIGSIG && !ima_present)
244-
return -EPERM;
244+
error = -EPERM;
245245
out:
246246
kfree(xattr_value);
247247
kfree(desc);

0 commit comments

Comments
 (0)