* [PATCH] evm: Fix possible memory leak in evm_calc_hmac_or_hash()
@ 2020-04-14 8:01 Roberto Sassu
2020-04-14 13:48 ` Mimi Zohar
0 siblings, 1 reply; 2+ messages in thread
From: Roberto Sassu @ 2020-04-14 8:01 UTC (permalink / raw)
To: zohar, mjg59
Cc: linux-integrity, linux-security-module, linux-kernel,
silviu.vlasceanu, Roberto Sassu, stable
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().
Cc: stable@vger.kernel.org
Fixes: 50b977481fce9 ("EVM: Add support for portable signature format")
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
---
security/integrity/evm/evm_crypto.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
index 35682852ddea..499ea01b2edc 100644
--- a/security/integrity/evm/evm_crypto.c
+++ b/security/integrity/evm/evm_crypto.c
@@ -241,7 +241,7 @@ static int evm_calc_hmac_or_hash(struct dentry *dentry,
/* Portable EVM signatures must include an IMA hash */
if (type == EVM_XATTR_PORTABLE_DIGSIG && !ima_present)
- return -EPERM;
+ error = -EPERM;
out:
kfree(xattr_value);
kfree(desc);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] evm: Fix possible memory leak in evm_calc_hmac_or_hash()
2020-04-14 8:01 [PATCH] evm: Fix possible memory leak in evm_calc_hmac_or_hash() Roberto Sassu
@ 2020-04-14 13:48 ` Mimi Zohar
0 siblings, 0 replies; 2+ messages in thread
From: Mimi Zohar @ 2020-04-14 13:48 UTC (permalink / raw)
To: Roberto Sassu, mjg59
Cc: linux-integrity, linux-security-module, linux-kernel,
silviu.vlasceanu, stable
Thanks, Roberto.
Sorry for the delays in reviewing the miscellaneous set of IMA patches
you previously posted. They're next on my "todo" list.
Mimi
On Tue, 2020-04-14 at 10:01 +0200, Roberto Sassu wrote:
> 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().
>
> Cc: stable@vger.kernel.org
> Fixes: 50b977481fce9 ("EVM: Add support for portable signature format")
> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> ---
> security/integrity/evm/evm_crypto.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
> index 35682852ddea..499ea01b2edc 100644
> --- a/security/integrity/evm/evm_crypto.c
> +++ b/security/integrity/evm/evm_crypto.c
> @@ -241,7 +241,7 @@ static int evm_calc_hmac_or_hash(struct dentry *dentry,
>
> /* Portable EVM signatures must include an IMA hash */
> if (type == EVM_XATTR_PORTABLE_DIGSIG && !ima_present)
> - return -EPERM;
> + error = -EPERM;
> out:
> kfree(xattr_value);
> kfree(desc);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-14 13:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-14 8:01 [PATCH] evm: Fix possible memory leak in evm_calc_hmac_or_hash() Roberto Sassu
2020-04-14 13:48 ` Mimi Zohar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).