plpks_confirm_object_flushed() returns zero or a negative Linux errno.
However, plpks_write_var() and plpks_remove_var() pass 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 the write and remove HCALLs, and propagate
errors from plpks_confirm_object_flushed() unchanged.

Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore")
Cc: [email protected] # 6.0
Signed-off-by: Srish Srinivasan <[email protected]>
---
 arch/powerpc/platforms/pseries/plpks.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/plpks.c 
b/arch/powerpc/platforms/pseries/plpks.c
index 240cd5632446..c86960f102dc 100644
--- a/arch/powerpc/platforms/pseries/plpks.c
+++ b/arch/powerpc/platforms/pseries/plpks.c
@@ -750,8 +750,9 @@ int plpks_write_var(struct plpks_var var)
 
        if (!rc)
                rc = plpks_confirm_object_flushed(label, auth);
+       else
+               rc = pseries_status_to_err(rc);
 
-       rc = pseries_status_to_err(rc);
        kfree(label);
 out:
        kfree_sensitive(auth);
@@ -808,8 +809,9 @@ int plpks_remove_var(char *component, u8 varos, struct 
plpks_var_name vname)
 
        if (!rc)
                rc = plpks_confirm_object_flushed(label, auth);
+       else
+               rc = pseries_status_to_err(rc);
 
-       rc = pseries_status_to_err(rc);
        kfree(label);
 out:
        kfree_sensitive(auth);
-- 
2.52.0


Reply via email to