[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1101232237020.30955@swampdragon.chaosbits.net>
Date: Sun, 23 Jan 2011 22:40:42 +0100 (CET)
From: Jesper Juhl <jj@...osbits.net>
To: David Howells <dhowells@...hat.com>
cc: David Safford <safford@...ibm.com>,
James Morris <jmorris@...ei.org>, keyrings@...ux-nfs.org,
linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] trusted keys: Fix a memory leak in trusted_update().
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@...osbits.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@...osbits.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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists