PLPKS read, remove, and write operations use authentication buffers that
contain passwords. The read output buffer may also contain sensitive data.
Freeing these buffers with kfree(), without wiping the contents, can leave
sensitive data in memory.
Use kfree_sensitive() to wipe the buffers when freeing them.
Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore")
Cc: [email protected] # 6.0
Signed-off-by: Srish Srinivasan <[email protected]>
Reviewed-by: Nayna Jain <[email protected]>
Tested-by: R Nageswara Sastry <[email protected]>
---
arch/powerpc/platforms/pseries/plpks.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/plpks.c
b/arch/powerpc/platforms/pseries/plpks.c
index e3ae2cd78247..8dbf85e9714c 100644
--- a/arch/powerpc/platforms/pseries/plpks.c
+++ b/arch/powerpc/platforms/pseries/plpks.c
@@ -754,7 +754,7 @@ int plpks_write_var(struct plpks_var var)
rc = pseries_status_to_err(rc);
kfree(label);
out:
- kfree(auth);
+ kfree_sensitive(auth);
return rc;
}
@@ -812,7 +812,7 @@ int plpks_remove_var(char *component, u8 varos, struct
plpks_var_name vname)
rc = pseries_status_to_err(rc);
kfree(label);
out:
- kfree(auth);
+ kfree_sensitive(auth);
return rc;
}
@@ -878,11 +878,11 @@ static int plpks_read_var(u8 consumer, struct plpks_var
*var)
out_copy_policy:
var->policy = retbuf[1];
out_free_output:
- kfree(output);
+ kfree_sensitive(output);
out_free_label:
kfree(label);
out_free_auth:
- kfree(auth);
+ kfree_sensitive(auth);
return rc;
}
--
2.52.0