Skip to content

Commit 6de5045

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 ce7f038 commit 6de5045

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
@@ -243,7 +243,7 @@ static int evm_calc_hmac_or_hash(struct dentry *dentry,
243243

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

0 commit comments

Comments
 (0)