Skip to content

Commit

Permalink
keys: ensure that ->match_free() is called in request_key_and_link()
Browse files Browse the repository at this point in the history
If check_cached_key() returns a non-NULL value, we still need to call
key_type::match_free() to undo key_type::match_preparse().

Fixes: 7743c48 ("keys: Cache result of request_key*() temporarily in task_struct")
Signed-off-by: Eric Biggers <[email protected]>
Signed-off-by: David Howells <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
ebiggers authored and torvalds committed Aug 30, 2019
1 parent e8d6766 commit 846d2db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion security/keys/request_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ struct key *request_key_and_link(struct key_type *type,

key = check_cached_key(&ctx);
if (key)
return key;
goto error_free;

/* search all the process keyrings for a key */
rcu_read_lock();
Expand Down

0 comments on commit 846d2db

Please sign in to comment.