From: Mimi Zohar <zohar@linux.vnet.ibm.com>
To: Roberto Sassu <roberto.sassu@polito.it>
Cc: keyrings@linux-nfs.org, linux-crypto@vger.kernel.org,
David Howells <dhowells@redhat.com>,
David Safford <safford@watson.ibm.com>,
Rajiv Andrade <srajiv@linux.vnet.ibm.com>,
linux-security-module@vger.kernel.org
Subject: Re: [PATCH 2/2] keys: added cleanup code for trusted and encrypted key types
Date: Thu, 07 Oct 2010 17:05:01 -0400 [thread overview]
Message-ID: <1286485501.2809.9.camel@localhost.localdomain> (raw)
In-Reply-To: <201010071430.46281.roberto.sassu@polito.it>
Thanks for catching this! This patch applies cleanly to the
trusted/encrypted patch set posted today.
thanks,
Acked-by: Mimi Zohar <zohar@us.ibm.com>
On Thu, 2010-10-07 at 14:30 +0200, Roberto Sassu wrote:
> This patch frees the payload at the end of the instantiate
> method of both trusted and encrypted key types if an error occurs.
>
> Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
> ---
> security/keys/encrypted_defined.c | 6 ++++++
> security/keys/trusted_defined.c | 4 ++++
> 2 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/security/keys/encrypted_defined.c b/security/keys/encrypted_defined.c
> index 54c0f0f..8426e66 100644
> --- a/security/keys/encrypted_defined.c
> +++ b/security/keys/encrypted_defined.c
> @@ -624,7 +624,13 @@ static int encrypted_instantiate(struct key *key, const void *data,
> }
> ret = encrypted_init(epayload, master_desc, decrypted_datalen,
> hex_encoded_iv, hex_encoded_data);
> + if (ret)
> + goto out_free_epayload;
> +
> rcu_assign_pointer(key->payload.data, epayload);
> +out_free_epayload:
> + if (ret)
> + kfree(epayload);
> out:
> kfree(datablob);
> return ret > 0 ? -EINVAL : ret;
> diff --git a/security/keys/trusted_defined.c b/security/keys/trusted_defined.c
> index aedad16..ab7c7f9 100644
> --- a/security/keys/trusted_defined.c
> +++ b/security/keys/trusted_defined.c
> @@ -848,6 +848,10 @@ static int trusted_instantiate(struct key *key, const void *data,
> out:
> if (!ret)
> rcu_assign_pointer(key->payload.data, p);
> + else {
> + if (p)
> + kfree(p);
> + }
> kfree(datablob);
> return ret;
> }
next prev parent reply other threads:[~2010-10-07 21:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-07 12:30 [PATCH 2/2] keys: added cleanup code for trusted and encrypted key types Roberto Sassu
2010-10-07 21:05 ` Mimi Zohar [this message]
2010-10-07 21:38 ` James Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1286485501.2809.9.camel@localhost.localdomain \
--to=zohar@linux.vnet.ibm.com \
--cc=dhowells@redhat.com \
--cc=keyrings@linux-nfs.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=roberto.sassu@polito.it \
--cc=safford@watson.ibm.com \
--cc=srajiv@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox