Skip to content

Commit e445da3

Browse files
robertosassugregkh
authored andcommitted
evm: Fix possible memory leak in evm_calc_hmac_or_hash()
commit 0c4395f upstream. 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 <roberto.sassu@huawei.com> Cc: stable@vger.kernel.org Signed-off-by: Mimi Zohar <zohar@linux.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a095fc2 commit e445da3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎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)