summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesper Juhl <jj@chaosbits.net>2011-01-23 22:40:42 +0100
committerJames Morris <jmorris@namei.org>2011-01-24 10:59:58 +1100
commit5403110943a2dcf1f96416d7a412a8b46895facd (patch)
tree48e3501e71511200c911315b8bdffde4788d357d
parent7f3c68bee977ab872827e44de017216736fe21d7 (diff)
trusted keys: Fix a memory leak in trusted_update().
One failure path in security/keys/trusted.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> Signed-off-by: James Morris <jmorris@namei.org>
-rw-r--r--security/keys/trusted.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/security/keys/trusted.c b/security/keys/trusted.c
index 3066f56c7676..83fc92e297cd 100644
--- a/security/keys/trusted.c
+++ b/security/keys/trusted.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 */