summaryrefslogtreecommitdiffstats
path: root/security/keys/request_key.c
diff options
context:
space:
mode:
authorEric Biggers2017-12-08 16:13:27 +0100
committerDavid Howells2017-12-08 16:13:27 +0100
commita2d8737d5c781d388b553dd085b56d7295fffc6c (patch)
treee1a015e62fcb62ea4b6c1a3993e0dcbf415cffc5 /security/keys/request_key.c
parentMerge tag 'docs-4.15-fixes' of git://git.lwn.net/linux (diff)
downloadkernel-qcow2-linux-a2d8737d5c781d388b553dd085b56d7295fffc6c.tar.gz
kernel-qcow2-linux-a2d8737d5c781d388b553dd085b56d7295fffc6c.tar.xz
kernel-qcow2-linux-a2d8737d5c781d388b553dd085b56d7295fffc6c.zip
KEYS: remove unnecessary get/put of explicit dest_keyring
In request_key_and_link(), in the case where the dest_keyring was explicitly specified, there is no need to get another reference to dest_keyring before calling key_link(), then drop it afterwards. This is because by definition, we already have a reference to dest_keyring. This change is useful because we'll be making construct_get_dest_keyring() able to return an error code, and we don't want to have to handle that error here for no reason. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'security/keys/request_key.c')
-rw-r--r--security/keys/request_key.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index e8036cd0ad54..c6880af8b411 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -546,9 +546,7 @@ struct key *request_key_and_link(struct key_type *type,
if (!IS_ERR(key_ref)) {
key = key_ref_to_ptr(key_ref);
if (dest_keyring) {
- construct_get_dest_keyring(&dest_keyring);
ret = key_link(dest_keyring, key);
- key_put(dest_keyring);
if (ret < 0) {
key_put(key);
key = ERR_PTR(ret);