summaryrefslogtreecommitdiffstats
path: root/security/keys
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2019-08-30 16:52:26 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2019-08-30 11:10:55 -0700
commit846d2db3e00048da3f650e0cfb0b8d67669cec3e (patch)
tree7978fd3878ea066d07ebde04a059ac9b3faff3c3 /security/keys
parente8d6766f3cc8318e8fcaa5ef2d1af4d2d9903af3 (diff)
downloadlinux-846d2db3e00048da3f650e0cfb0b8d67669cec3e.tar.bz2
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: 7743c48e54ee ("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>
Diffstat (limited to 'security/keys')
-rw-r--r--security/keys/request_key.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index 7325f382dbf4..957b9e3e1492 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -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();