plpks_confirm_object_flushed() returns zero or a negative Linux errno.
However, plpks_gen_wrapping_key() passes this return value through
pseries_status_to_err(), which treats it as a raw hypervisor status and
converts it again.
Convert only errors returned by H_PKS_GEN_KEY, and propagate errors from
plpks_confirm_object_flushed() unchanged.
Fixes: 133aa79e211d ("pseries/plpks: add HCALLs for PowerVM Key Wrapping
Module")
Cc: [email protected] # 7.0
Signed-off-by: Srish Srinivasan <[email protected]>
---
arch/powerpc/platforms/pseries/plpks.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/plpks.c
b/arch/powerpc/platforms/pseries/plpks.c
index c86960f102dc..584091f9aa08 100644
--- a/arch/powerpc/platforms/pseries/plpks.c
+++ b/arch/powerpc/platforms/pseries/plpks.c
@@ -938,7 +938,7 @@ int plpks_gen_wrapping_key(void)
unsigned long retbuf[PLPAR_HCALL_BUFSIZE] = { 0 };
struct plpks_auth *auth;
struct label *label;
- int rc = 0, pseries_status = 0;
+ int rc, pseries_status;
struct plpks_var var = {
.name = PLPKS_DEFAULT_WRAPKEY_LABEL,
.namelen = sizeof(PLPKS_DEFAULT_WRAPKEY_LABEL) - 1,
@@ -962,17 +962,17 @@ int plpks_gen_wrapping_key(void)
label->size, var.policy,
NULL, PLPKS_WRAPPING_KEY_LENGTH);
- if (!rc)
+ if (!rc) {
rc = plpks_confirm_object_flushed(label, auth);
-
- pseries_status = rc;
- rc = pseries_status_to_err(rc);
-
- if (rc && rc != -EEXIST) {
- pr_err("H_PKS_GEN_KEY failed. pseries_status=%d, rc=%d",
- pseries_status, rc);
} else {
- rc = 0;
+ pseries_status = rc;
+ rc = pseries_status_to_err(rc);
+
+ if (rc != -EEXIST)
+ pr_err("H_PKS_GEN_KEY failed. pseries_status=%d, rc=%d",
+ pseries_status, rc);
+ else
+ rc = 0;
}
kfree(label);
--
2.52.0