* [PATCH] trusted keys: Fix a memory leak in trusted_update().
@ 2011-01-23 21:40 Jesper Juhl
2011-01-24 0:00 ` James Morris
0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2011-01-23 21:40 UTC (permalink / raw)
To: David Howells
Cc: David Safford, James Morris, keyrings, linux-security-module,
linux-kernel
One failure path in security/keys/trusted_defined.c::trusted_update() does
not free 'new_p' while the others do. This patch makes sure we also free
it in the remaining path (if datablob_parse() returns different from
Opt_update).
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
trusted_defined.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/security/keys/trusted_defined.c b/security/keys/trusted_defined.c
index 2836c6d..bae582b 100644
--- a/security/keys/trusted_defined.c
+++ b/security/keys/trusted_defined.c
@@ -1032,6 +1032,7 @@ static int trusted_update(struct key *key, const void *data, size_t datalen)
ret = datablob_parse(datablob, new_p, new_o);
if (ret != Opt_update) {
ret = -EINVAL;
+ kfree(new_p);
goto out;
}
/* copy old key values, and reseal with new pcrs */
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] trusted keys: Fix a memory leak in trusted_update().
2011-01-23 21:40 [PATCH] trusted keys: Fix a memory leak in trusted_update() Jesper Juhl
@ 2011-01-24 0:00 ` James Morris
0 siblings, 0 replies; 2+ messages in thread
From: James Morris @ 2011-01-24 0:00 UTC (permalink / raw)
To: Jesper Juhl
Cc: David Howells, David Safford, keyrings, linux-security-module,
linux-kernel
On Sun, 23 Jan 2011, Jesper Juhl wrote:
> One failure path in security/keys/trusted_defined.c::trusted_update() does
> not free 'new_p' while the others do. This patch makes sure we also free
> it in the remaining path (if datablob_parse() returns different from
> Opt_update).
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#for-linus
with filename change fixups.
> ---
> trusted_defined.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/security/keys/trusted_defined.c b/security/keys/trusted_defined.c
> index 2836c6d..bae582b 100644
> --- a/security/keys/trusted_defined.c
> +++ b/security/keys/trusted_defined.c
> @@ -1032,6 +1032,7 @@ static int trusted_update(struct key *key, const void *data, size_t datalen)
> ret = datablob_parse(datablob, new_p, new_o);
> if (ret != Opt_update) {
> ret = -EINVAL;
> + kfree(new_p);
> goto out;
> }
> /* copy old key values, and reseal with new pcrs */
>
>
> --
> Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
> Plain text mails only, please.
>
--
James Morris
<jmorris@namei.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-24 0:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-23 21:40 [PATCH] trusted keys: Fix a memory leak in trusted_update() Jesper Juhl
2011-01-24 0:00 ` James Morris
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).