zkey: Fix generate and import leaving key in an inconsistent state

When a volume or APQN association is made while generating or
importing a key, and a duplicate association is detected, then
this may leave the key in an inconsistent state.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Ingo Franzki
2018-06-19 13:59:11 +02:00
committed by Jan Höppner
parent 344965bd29
commit 672548ce30
+2 -2
View File
@@ -1534,7 +1534,7 @@ int keystore_generate_key(struct keystore *keystore, const char *name,
out_free_props:
if (key_props != NULL)
properties_free(key_props);
if (rc != 0 && rc != -EEXIST)
if (rc != 0)
remove(file_names.skey_filename);
out_free_key_filenames:
_keystore_free_key_filenames(&file_names);
@@ -1617,7 +1617,7 @@ int keystore_import_key(struct keystore *keystore, const char *name,
out_free_props:
if (key_props != NULL)
properties_free(key_props);
if (rc != 0 && rc != -EEXIST)
if (rc != 0)
remove(file_names.skey_filename);
out_free_key_filenames:
_keystore_free_key_filenames(&file_names);