Skip to content

Commit 846d2db

Browse files
ebiggerstorvalds
authored andcommitted
keys: ensure that ->match_free() is called in request_key_and_link()
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 <ebiggers@google.com> Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent e8d6766 commit 846d2db

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎security/keys/request_key.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ struct key *request_key_and_link(struct key_type *type,
595595

596596
key = check_cached_key(&ctx);
597597
if (key)
598-
return key;
598+
goto error_free;
599599

600600
/* search all the process keyrings for a key */
601601
rcu_read_lock();

0 commit comments

Comments
 (0)