Skip to content

Commit

Permalink
trusted keys: Fix a memory leak in trusted_update().
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jesper Juhl authored and James Morris committed Jan 23, 2011
1 parent 7f3c68b commit 5403110
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions security/keys/trusted.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 5403110

Please sign in to comment.