diff options
author | David Howells <dhowells@redhat.com> | 2014-07-18 13:56:34 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2014-07-22 16:46:12 -0400 |
commit | 4d8c0250b841159b128785f7a7efbaff40cc8501 (patch) | |
tree | 88860f5296ab855ba75588a0ec3e9fce73b7def3 /security | |
parent | 7dfa0ca6a95de65b7a7760630cdbd7d30f204bfa (diff) |
KEYS: Call ->free_preparse() even after ->preparse() returns an error
Call the ->free_preparse() key type op even after ->preparse() returns an
error as it does cleaning up type stuff.
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Steve Dickson <steved@redhat.com>
Acked-by: Jeff Layton <jlayton@primarydata.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/keys/key.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/security/keys/key.c b/security/keys/key.c index 755fb02df5af..b90a68c4e2c4 100644 --- a/security/keys/key.c +++ b/security/keys/key.c | |||
@@ -494,7 +494,7 @@ int key_instantiate_and_link(struct key *key, | |||
494 | if (keyring) { | 494 | if (keyring) { |
495 | ret = __key_link_begin(keyring, &key->index_key, &edit); | 495 | ret = __key_link_begin(keyring, &key->index_key, &edit); |
496 | if (ret < 0) | 496 | if (ret < 0) |
497 | goto error_free_preparse; | 497 | goto error; |
498 | } | 498 | } |
499 | 499 | ||
500 | ret = __key_instantiate_and_link(key, &prep, keyring, authkey, &edit); | 500 | ret = __key_instantiate_and_link(key, &prep, keyring, authkey, &edit); |
@@ -502,10 +502,9 @@ int key_instantiate_and_link(struct key *key, | |||
502 | if (keyring) | 502 | if (keyring) |
503 | __key_link_end(keyring, &key->index_key, edit); | 503 | __key_link_end(keyring, &key->index_key, edit); |
504 | 504 | ||
505 | error_free_preparse: | 505 | error: |
506 | if (key->type->preparse) | 506 | if (key->type->preparse) |
507 | key->type->free_preparse(&prep); | 507 | key->type->free_preparse(&prep); |
508 | error: | ||
509 | return ret; | 508 | return ret; |
510 | } | 509 | } |
511 | 510 | ||
@@ -822,7 +821,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref, | |||
822 | ret = index_key.type->preparse(&prep); | 821 | ret = index_key.type->preparse(&prep); |
823 | if (ret < 0) { | 822 | if (ret < 0) { |
824 | key_ref = ERR_PTR(ret); | 823 | key_ref = ERR_PTR(ret); |
825 | goto error_put_type; | 824 | goto error_free_prep; |
826 | } | 825 | } |
827 | if (!index_key.description) | 826 | if (!index_key.description) |
828 | index_key.description = prep.description; | 827 | index_key.description = prep.description; |
@@ -964,9 +963,9 @@ int key_update(key_ref_t key_ref, const void *payload, size_t plen) | |||
964 | 963 | ||
965 | up_write(&key->sem); | 964 | up_write(&key->sem); |
966 | 965 | ||
966 | error: | ||
967 | if (key->type->preparse) | 967 | if (key->type->preparse) |
968 | key->type->free_preparse(&prep); | 968 | key->type->free_preparse(&prep); |
969 | error: | ||
970 | return ret; | 969 | return ret; |
971 | } | 970 | } |
972 | EXPORT_SYMBOL(key_update); | 971 | EXPORT_SYMBOL(key_update); |