Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH v6 1/9] keys/trusted_keys: propagate wrapping key generation errors
       [not found] <20261105144320.357260-1-ssrish@linux.ibm.com>
@ 2026-11-05 14:43 ` Srish Srinivasan
  2026-11-05 17:11   ` Jarkko Sakkinen
  2026-11-05 14:43 ` [PATCH v6 2/9] keys/trusted_keys: fix PKWM output buffer cleanup Srish Srinivasan
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Srish Srinivasan @ 2026-11-05 14:43 UTC (permalink / raw)
  To: linux-integrity, keyrings, linuxppc-dev
  Cc: maddy, ritesh.list, sshegde, mpe, npiggin, christophe.leroy,
	James.Bottomley, jarkko, zohar, linux-kernel,
	linux-security-module, nayna, rnsastry, ssrish, stable

plpks_gen_wrapping_key() returns a negative errno when default wrapping key
generation fails. However, trusted_pkwm_init() returns -EINVAL for all such
failures, discarding the original error.

Propagate the error returned by plpks_gen_wrapping_key() unchanged.

Fixes: c99fcb0d735b ("keys/trusted_keys: establish PKWM as a trusted source")
Cc: stable@vger.kernel.org # 7.0
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
Tested-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
---
 security/keys/trusted-keys/trusted_pkwm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/keys/trusted-keys/trusted_pkwm.c b/security/keys/trusted-keys/trusted_pkwm.c
index bf42c6679245..422f752598e1 100644
--- a/security/keys/trusted-keys/trusted_pkwm.c
+++ b/security/keys/trusted-keys/trusted_pkwm.c
@@ -170,7 +170,7 @@ static int trusted_pkwm_init(void)
 	ret = plpks_gen_wrapping_key();
 	if (ret) {
 		pr_err("Failed to generate default wrapping key\n");
-		return -EINVAL;
+		return ret;
 	}
 
 	return register_key_type(&key_type_trusted);
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v6 2/9] keys/trusted_keys: fix PKWM output buffer cleanup
       [not found] <20261105144320.357260-1-ssrish@linux.ibm.com>
  2026-11-05 14:43 ` [PATCH v6 1/9] keys/trusted_keys: propagate wrapping key generation errors Srish Srinivasan
@ 2026-11-05 14:43 ` Srish Srinivasan
  2026-11-05 17:12   ` Jarkko Sakkinen
  2026-11-05 14:43 ` [PATCH v6 3/9] keys/trusted_keys: clear sensitive PKWM buffers Srish Srinivasan
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Srish Srinivasan @ 2026-11-05 14:43 UTC (permalink / raw)
  To: linux-integrity, keyrings, linuxppc-dev
  Cc: maddy, ritesh.list, sshegde, mpe, npiggin, christophe.leroy,
	James.Bottomley, jarkko, zohar, linux-kernel,
	linux-security-module, nayna, rnsastry, ssrish, stable

The PKWM seal and unseal paths unconditionally free their output buffers,
but the PLPKS helpers can return without initializing those pointers.

Initialize the output buffer pointers to NULL to make cleanup safe on early
failure paths.

Fixes: c99fcb0d735b ("keys/trusted_keys: establish PKWM as a trusted source")
Cc: stable@vger.kernel.org # 7.0
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
---
 security/keys/trusted-keys/trusted_pkwm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/security/keys/trusted-keys/trusted_pkwm.c b/security/keys/trusted-keys/trusted_pkwm.c
index 422f752598e1..97ffec0ce1b7 100644
--- a/security/keys/trusted-keys/trusted_pkwm.c
+++ b/security/keys/trusted-keys/trusted_pkwm.c
@@ -82,7 +82,7 @@ static int trusted_pkwm_seal(struct trusted_key_payload *p, char *datablob)
 {
 	struct trusted_key_options *options = NULL;
 	struct trusted_pkwm_options *pkwm = NULL;
-	u8 *input_buf, *output_buf;
+	u8 *input_buf, *output_buf = NULL;
 	u32 output_len, input_len;
 	int rc;
 
@@ -129,7 +129,7 @@ static int trusted_pkwm_seal(struct trusted_key_payload *p, char *datablob)
 
 static int trusted_pkwm_unseal(struct trusted_key_payload *p, char *datablob)
 {
-	u8 *input_buf, *output_buf;
+	u8 *input_buf, *output_buf = NULL;
 	u32 input_len, output_len;
 	int rc;
 
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v6 3/9] keys/trusted_keys: clear sensitive PKWM buffers
       [not found] <20261105144320.357260-1-ssrish@linux.ibm.com>
  2026-11-05 14:43 ` [PATCH v6 1/9] keys/trusted_keys: propagate wrapping key generation errors Srish Srinivasan
  2026-11-05 14:43 ` [PATCH v6 2/9] keys/trusted_keys: fix PKWM output buffer cleanup Srish Srinivasan
@ 2026-11-05 14:43 ` Srish Srinivasan
  2026-11-05 14:43 ` [PATCH v6 4/9] pseries/plpks: fix double conversion of write and remove flush errors Srish Srinivasan
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Srish Srinivasan @ 2026-11-05 14:43 UTC (permalink / raw)
  To: linux-integrity, keyrings, linuxppc-dev
  Cc: maddy, ritesh.list, sshegde, mpe, npiggin, christophe.leroy,
	James.Bottomley, jarkko, zohar, linux-kernel,
	linux-security-module, nayna, rnsastry, ssrish, stable

The input buffer to PKWM seal and the output buffer from PKWM unseal
contain plaintext trusted-key payload data. Freeing these buffers with
kfree(), without wiping the contents, can leave sensitive key material
in memory.

Use kfree_sensitive() to wipe the sensitive key material when freeing
these buffers.

Fixes: c99fcb0d735b ("keys/trusted_keys: establish PKWM as a trusted source")
Cc: stable@vger.kernel.org # 7.0
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
Reviewed-by: Nayna Jain <nayna@linux.ibm.com>
Tested-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
---
 security/keys/trusted-keys/trusted_pkwm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/security/keys/trusted-keys/trusted_pkwm.c b/security/keys/trusted-keys/trusted_pkwm.c
index 97ffec0ce1b7..be69d2b6d46b 100644
--- a/security/keys/trusted-keys/trusted_pkwm.c
+++ b/security/keys/trusted-keys/trusted_pkwm.c
@@ -118,7 +118,7 @@ static int trusted_pkwm_seal(struct trusted_key_payload *p, char *datablob)
 		pr_err("Wrapping of payload key failed: %d\n", rc);
 	}
 
-	kfree(input_buf);
+	kfree_sensitive(input_buf);
 	kfree(output_buf);
 
 out:
@@ -153,7 +153,7 @@ static int trusted_pkwm_unseal(struct trusted_key_payload *p, char *datablob)
 	}
 
 	kfree(input_buf);
-	kfree(output_buf);
+	kfree_sensitive(output_buf);
 
 	return rc;
 }
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v6 4/9] pseries/plpks: fix double conversion of write and remove flush errors
       [not found] <20261105144320.357260-1-ssrish@linux.ibm.com>
                   ` (2 preceding siblings ...)
  2026-11-05 14:43 ` [PATCH v6 3/9] keys/trusted_keys: clear sensitive PKWM buffers Srish Srinivasan
@ 2026-11-05 14:43 ` Srish Srinivasan
  2026-11-05 14:43 ` [PATCH v6 5/9] pseries/plpks: fix double conversion of wrapping key " Srish Srinivasan
  2026-11-05 14:43 ` [PATCH v6 6/9] pseries/plpks: fix length types for wrapping operations Srish Srinivasan
  5 siblings, 0 replies; 8+ messages in thread
From: Srish Srinivasan @ 2026-11-05 14:43 UTC (permalink / raw)
  To: linux-integrity, keyrings, linuxppc-dev
  Cc: maddy, ritesh.list, sshegde, mpe, npiggin, christophe.leroy,
	James.Bottomley, jarkko, zohar, linux-kernel,
	linux-security-module, nayna, rnsastry, ssrish, stable

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: stable@vger.kernel.org # 6.0
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
---
 arch/powerpc/platforms/pseries/plpks.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c
index 240cd5632446..110251914b51 100644
--- a/arch/powerpc/platforms/pseries/plpks.c
+++ b/arch/powerpc/platforms/pseries/plpks.c
@@ -714,6 +714,7 @@ int plpks_signed_update_var(struct plpks_var *var, u64 flags)
  * -ENOMEM	if unable to store the requested object in the space available
  * -EBUSY	if unable to handle the request
  * -EEXIST	if the object label already exists
+ * -ETIMEDOUT	if the object was not flushed to storage in time
  *
  * Returns: On success 0 is returned, a negative errno if not.
  */
@@ -750,8 +751,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);
@@ -780,6 +782,7 @@ int plpks_write_var(struct plpks_var var)
  * -EPERM	if access is denied
  * -ENOENT	if the requested object was not found
  * -EBUSY	if unable to handle the request
+ * -ETIMEDOUT	if the object was not flushed to storage in time
  *
  * Returns: On success 0 is returned, a negative errno if not.
  */
@@ -808,8 +811,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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v6 5/9] pseries/plpks: fix double conversion of wrapping key flush errors
       [not found] <20261105144320.357260-1-ssrish@linux.ibm.com>
                   ` (3 preceding siblings ...)
  2026-11-05 14:43 ` [PATCH v6 4/9] pseries/plpks: fix double conversion of write and remove flush errors Srish Srinivasan
@ 2026-11-05 14:43 ` Srish Srinivasan
  2026-11-05 14:43 ` [PATCH v6 6/9] pseries/plpks: fix length types for wrapping operations Srish Srinivasan
  5 siblings, 0 replies; 8+ messages in thread
From: Srish Srinivasan @ 2026-11-05 14:43 UTC (permalink / raw)
  To: linux-integrity, keyrings, linuxppc-dev
  Cc: maddy, ritesh.list, sshegde, mpe, npiggin, christophe.leroy,
	James.Bottomley, jarkko, zohar, linux-kernel,
	linux-security-module, nayna, rnsastry, ssrish, stable

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: stable@vger.kernel.org # 7.0: a2df535d9dd9: pseries/plpks: rename the default wrapping key macro
Cc: stable@vger.kernel.org # 7.0
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
---
 arch/powerpc/platforms/pseries/plpks.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c
index 110251914b51..376c50d459fc 100644
--- a/arch/powerpc/platforms/pseries/plpks.c
+++ b/arch/powerpc/platforms/pseries/plpks.c
@@ -932,6 +932,7 @@ EXPORT_SYMBOL_GPL(plpks_wrapping_is_supported);
  * -ENOMEM	if there is inadequate memory to perform this operation
  * -EBUSY	if unable to handle the request
  * -EEXIST	if the object label already exists
+ * -ETIMEDOUT	if the object was not flushed to storage in time
  *
  * Returns: On success 0 is returned, a negative errno if not.
  */
@@ -940,7 +941,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,
@@ -964,17 +965,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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v6 6/9] pseries/plpks: fix length types for wrapping operations
       [not found] <20261105144320.357260-1-ssrish@linux.ibm.com>
                   ` (4 preceding siblings ...)
  2026-11-05 14:43 ` [PATCH v6 5/9] pseries/plpks: fix double conversion of wrapping key " Srish Srinivasan
@ 2026-11-05 14:43 ` Srish Srinivasan
  5 siblings, 0 replies; 8+ messages in thread
From: Srish Srinivasan @ 2026-11-05 14:43 UTC (permalink / raw)
  To: linux-integrity, keyrings, linuxppc-dev
  Cc: maddy, ritesh.list, sshegde, mpe, npiggin, christophe.leroy,
	James.Bottomley, jarkko, zohar, linux-kernel,
	linux-security-module, nayna, rnsastry, ssrish, stable

The object wrapping and unwrapping HCALLs use 64-bit length values, but
plpks_wrap_object() and plpks_unwrap_object() currently use u32 for the
input and output length parameters.

Use u64 for the length parameters to match the underlying HCALL interfaces,
and update the PKWM consumer accordingly. Validate input lengths against
the HCALL-defined limits before calculating output buffer sizes.

Fixes: 133aa79e211d ("pseries/plpks: add HCALLs for PowerVM Key Wrapping Module")
Fixes: c99fcb0d735b ("keys/trusted_keys: establish PKWM as a trusted source")
Cc: stable@vger.kernel.org # 7.0
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
---
 arch/powerpc/include/asm/plpks.h          |  8 ++++----
 arch/powerpc/platforms/pseries/plpks.c    | 23 +++++++++++++++++------
 security/keys/trusted-keys/trusted_pkwm.c |  4 ++--
 3 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/include/asm/plpks.h b/arch/powerpc/include/asm/plpks.h
index e87f90e40d4e..8b2ffb27db5a 100644
--- a/arch/powerpc/include/asm/plpks.h
+++ b/arch/powerpc/include/asm/plpks.h
@@ -118,11 +118,11 @@ bool plpks_wrapping_is_supported(void);
 
 int plpks_gen_wrapping_key(void);
 
-int plpks_wrap_object(u8 **input_buf, u32 input_len, u16 wrap_flags,
-		      u8 **output_buf, u32 *output_len);
+int plpks_wrap_object(u8 **input_buf, u64 input_len, u16 wrap_flags,
+		      u8 **output_buf, u64 *output_len);
 
-int plpks_unwrap_object(u8 **input_buf, u32 input_len,
-			u8 **output_buf, u32 *output_len);
+int plpks_unwrap_object(u8 **input_buf, u64 input_len,
+			u8 **output_buf, u64 *output_len);
 #else // CONFIG_PSERIES_PLPKS
 static inline bool plpks_is_available(void) { return false; }
 static inline u16 plpks_get_passwordlen(void) { BUILD_BUG(); }
diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c
index 376c50d459fc..d5adc563f71f 100644
--- a/arch/powerpc/platforms/pseries/plpks.c
+++ b/arch/powerpc/platforms/pseries/plpks.c
@@ -22,6 +22,9 @@
  * than the input buffer's length during the WRAP H_CALL
  */
 #define PLPKS_WRAPPING_BUF_DIFF	1024
+#define PLPKS_MAX_WRAPPING_INPUT_SIZE	(32 * 1024)
+#define PLPKS_MAX_WRAPPED_OBJECT_SIZE	\
+	(PLPKS_MAX_WRAPPING_INPUT_SIZE + PLPKS_WRAPPING_BUF_DIFF)
 
 #define PLPKS_WRAP_INTERFACE_BIT	3
 #define PLPKS_WRAPPING_KEY_LENGTH	32
@@ -989,7 +992,7 @@ EXPORT_SYMBOL_GPL(plpks_gen_wrapping_key);
  * plpks_wrap_object() - Wrap an object using the default wrapping key stored in
  * the PLPKS.
  * @input_buf: buffer containing the data to be wrapped
- * @input_len: length of the input buffer
+ * @input_len: length of the input buffer (non-zero, at most 32KB)
  * @wrap_flags: object wrapping flags
  * @output_buf: buffer to store the wrapped data
  * @output_len: length of the output buffer
@@ -1026,8 +1029,8 @@ EXPORT_SYMBOL_GPL(plpks_gen_wrapping_key);
  *
  * Returns: On success 0 is returned, a negative errno if not.
  */
-int plpks_wrap_object(u8 **input_buf, u32 input_len, u16 wrap_flags,
-		      u8 **output_buf, u32 *output_len)
+int plpks_wrap_object(u8 **input_buf, u64 input_len, u16 wrap_flags,
+		      u8 **output_buf, u64 *output_len)
 {
 	unsigned long retbuf[PLPAR_HCALL9_BUFSIZE] = { 0 };
 	struct plpks_auth *auth;
@@ -1044,6 +1047,9 @@ int plpks_wrap_object(u8 **input_buf, u32 input_len, u16 wrap_flags,
 		.component = PLPKS_WRAPKEY_COMPONENT
 	};
 
+	if (!input_len || input_len > PLPKS_MAX_WRAPPING_INPUT_SIZE)
+		return -EINVAL;
+
 	auth = construct_auth(PLPKS_OS_OWNER);
 	if (IS_ERR(auth))
 		return PTR_ERR(auth);
@@ -1114,7 +1120,7 @@ EXPORT_SYMBOL_GPL(plpks_wrap_object);
  * plpks_unwrap_object() - Unwrap an object using the default wrapping key
  * stored in the PLPKS.
  * @input_buf: buffer containing the data to be unwrapped
- * @input_len: length of the input buffer
+ * @input_len: length of the input buffer (more than 1KB, at most 33KB)
  * @output_buf: buffer to store the unwrapped data
  * @output_len: length of the output buffer
  *
@@ -1145,8 +1151,8 @@ EXPORT_SYMBOL_GPL(plpks_wrap_object);
  *
  * Returns: On success 0 is returned, a negative errno if not.
  */
-int plpks_unwrap_object(u8 **input_buf, u32 input_len, u8 **output_buf,
-			u32 *output_len)
+int plpks_unwrap_object(u8 **input_buf, u64 input_len, u8 **output_buf,
+			u64 *output_len)
 {
 	unsigned long retbuf[PLPAR_HCALL9_BUFSIZE] = { 0 };
 	struct plpks_auth *auth;
@@ -1154,6 +1160,11 @@ int plpks_unwrap_object(u8 **input_buf, u32 input_len, u8 **output_buf,
 	u64 objwrapflags = 0;
 	int rc = 0, pseries_status = 0;
 
+	/* outlen = inlen - 1KB must be non-zero */
+	if (input_len <= PLPKS_WRAPPING_BUF_DIFF ||
+	    input_len > PLPKS_MAX_WRAPPED_OBJECT_SIZE)
+		return -EINVAL;
+
 	auth = construct_auth(PLPKS_OS_OWNER);
 	if (IS_ERR(auth))
 		return PTR_ERR(auth);
diff --git a/security/keys/trusted-keys/trusted_pkwm.c b/security/keys/trusted-keys/trusted_pkwm.c
index be69d2b6d46b..b5c3d17be475 100644
--- a/security/keys/trusted-keys/trusted_pkwm.c
+++ b/security/keys/trusted-keys/trusted_pkwm.c
@@ -83,7 +83,7 @@ static int trusted_pkwm_seal(struct trusted_key_payload *p, char *datablob)
 	struct trusted_key_options *options = NULL;
 	struct trusted_pkwm_options *pkwm = NULL;
 	u8 *input_buf, *output_buf = NULL;
-	u32 output_len, input_len;
+	u64 output_len, input_len;
 	int rc;
 
 	options = trusted_options_alloc();
@@ -130,7 +130,7 @@ static int trusted_pkwm_seal(struct trusted_key_payload *p, char *datablob)
 static int trusted_pkwm_unseal(struct trusted_key_payload *p, char *datablob)
 {
 	u8 *input_buf, *output_buf = NULL;
-	u32 input_len, output_len;
+	u64 input_len, output_len;
 	int rc;
 
 	input_len = p->blob_len;
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v6 1/9] keys/trusted_keys: propagate wrapping key generation errors
  2026-11-05 14:43 ` [PATCH v6 1/9] keys/trusted_keys: propagate wrapping key generation errors Srish Srinivasan
@ 2026-11-05 17:11   ` Jarkko Sakkinen
  0 siblings, 0 replies; 8+ messages in thread
From: Jarkko Sakkinen @ 2026-11-05 17:11 UTC (permalink / raw)
  To: Srish Srinivasan
  Cc: linux-integrity, keyrings, linuxppc-dev, maddy, ritesh.list,
	sshegde, mpe, npiggin, christophe.leroy, James.Bottomley, zohar,
	linux-kernel, linux-security-module, nayna, rnsastry, stable

On Thu, Nov 05, 2026 at 08:13:12PM +0530, Srish Srinivasan wrote:
> plpks_gen_wrapping_key() returns a negative errno when default wrapping key
> generation fails. However, trusted_pkwm_init() returns -EINVAL for all such
> failures, discarding the original error.
> 
> Propagate the error returned by plpks_gen_wrapping_key() unchanged.
> 
> Fixes: c99fcb0d735b ("keys/trusted_keys: establish PKWM as a trusted source")
> Cc: stable@vger.kernel.org # 7.0
> Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
> Tested-by: R Nageswara Sastry <rnsastry@linux.ibm.com>

Nit: I'd put the SOB as last.

> ---
>  security/keys/trusted-keys/trusted_pkwm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/security/keys/trusted-keys/trusted_pkwm.c b/security/keys/trusted-keys/trusted_pkwm.c
> index bf42c6679245..422f752598e1 100644
> --- a/security/keys/trusted-keys/trusted_pkwm.c
> +++ b/security/keys/trusted-keys/trusted_pkwm.c
> @@ -170,7 +170,7 @@ static int trusted_pkwm_init(void)
>  	ret = plpks_gen_wrapping_key();
>  	if (ret) {
>  		pr_err("Failed to generate default wrapping key\n");
> -		return -EINVAL;
> +		return ret;
>  	}
>  
>  	return register_key_type(&key_type_trusted);
> -- 
> 2.52.0
> 

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

Br, Jarkko

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v6 2/9] keys/trusted_keys: fix PKWM output buffer cleanup
  2026-11-05 14:43 ` [PATCH v6 2/9] keys/trusted_keys: fix PKWM output buffer cleanup Srish Srinivasan
@ 2026-11-05 17:12   ` Jarkko Sakkinen
  0 siblings, 0 replies; 8+ messages in thread
From: Jarkko Sakkinen @ 2026-11-05 17:12 UTC (permalink / raw)
  To: Srish Srinivasan
  Cc: linux-integrity, keyrings, linuxppc-dev, maddy, ritesh.list,
	sshegde, mpe, npiggin, christophe.leroy, James.Bottomley, zohar,
	linux-kernel, linux-security-module, nayna, rnsastry, stable

On Thu, Nov 05, 2026 at 08:13:13PM +0530, Srish Srinivasan wrote:
> The PKWM seal and unseal paths unconditionally free their output buffers,
> but the PLPKS helpers can return without initializing those pointers.
> 
> Initialize the output buffer pointers to NULL to make cleanup safe on early
> failure paths.
> 
> Fixes: c99fcb0d735b ("keys/trusted_keys: establish PKWM as a trusted source")
> Cc: stable@vger.kernel.org # 7.0
> Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
> ---
>  security/keys/trusted-keys/trusted_pkwm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/security/keys/trusted-keys/trusted_pkwm.c b/security/keys/trusted-keys/trusted_pkwm.c
> index 422f752598e1..97ffec0ce1b7 100644
> --- a/security/keys/trusted-keys/trusted_pkwm.c
> +++ b/security/keys/trusted-keys/trusted_pkwm.c
> @@ -82,7 +82,7 @@ static int trusted_pkwm_seal(struct trusted_key_payload *p, char *datablob)
>  {
>  	struct trusted_key_options *options = NULL;
>  	struct trusted_pkwm_options *pkwm = NULL;
> -	u8 *input_buf, *output_buf;
> +	u8 *input_buf, *output_buf = NULL;
>  	u32 output_len, input_len;
>  	int rc;
>  
> @@ -129,7 +129,7 @@ static int trusted_pkwm_seal(struct trusted_key_payload *p, char *datablob)
>  
>  static int trusted_pkwm_unseal(struct trusted_key_payload *p, char *datablob)
>  {
> -	u8 *input_buf, *output_buf;
> +	u8 *input_buf, *output_buf = NULL;
>  	u32 input_len, output_len;
>  	int rc;
>  
> -- 
> 2.52.0
> 

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

Br, Jarkko


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-11-05 17:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261105144320.357260-1-ssrish@linux.ibm.com>
2026-11-05 14:43 ` [PATCH v6 1/9] keys/trusted_keys: propagate wrapping key generation errors Srish Srinivasan
2026-11-05 17:11   ` Jarkko Sakkinen
2026-11-05 14:43 ` [PATCH v6 2/9] keys/trusted_keys: fix PKWM output buffer cleanup Srish Srinivasan
2026-11-05 17:12   ` Jarkko Sakkinen
2026-11-05 14:43 ` [PATCH v6 3/9] keys/trusted_keys: clear sensitive PKWM buffers Srish Srinivasan
2026-11-05 14:43 ` [PATCH v6 4/9] pseries/plpks: fix double conversion of write and remove flush errors Srish Srinivasan
2026-11-05 14:43 ` [PATCH v6 5/9] pseries/plpks: fix double conversion of wrapping key " Srish Srinivasan
2026-11-05 14:43 ` [PATCH v6 6/9] pseries/plpks: fix length types for wrapping operations Srish Srinivasan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox