diff mbox series

crypto: ccp - Ensure psp_ret is always init'd in __sev_platform_init_locked()

Message ID 20220110211837.1442964-1-pgonda@google.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series crypto: ccp - Ensure psp_ret is always init'd in __sev_platform_init_locked() | expand

Commit Message

Peter Gonda Jan. 10, 2022, 9:18 p.m. UTC
Initialize psp_ret inside of __sev_platform_init_locked() because there
are many failure paths with PSP initialization that do not set
__sev_do_cmd_locked().

Fixes: e423b9d75e77: ("crypto: ccp - Move SEV_INIT retry for corrupted data")

Signed-off-by: Peter Gonda <pgonda@google.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Marc Orr <marcorr@google.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: John Allen <john.allen@amd.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/crypto/ccp/sev-dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Herbert Xu Jan. 28, 2022, 6:22 a.m. UTC | #1
On Mon, Jan 10, 2022 at 01:18:37PM -0800, Peter Gonda wrote:
> Initialize psp_ret inside of __sev_platform_init_locked() because there
> are many failure paths with PSP initialization that do not set
> __sev_do_cmd_locked().
> 
> Fixes: e423b9d75e77: ("crypto: ccp - Move SEV_INIT retry for corrupted data")
> 
> Signed-off-by: Peter Gonda <pgonda@google.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Cc: Brijesh Singh <brijesh.singh@amd.com>
> Cc: Marc Orr <marcorr@google.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: John Allen <john.allen@amd.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: linux-crypto@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  drivers/crypto/ccp/sev-dev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
index 8fd774a10edc..6ab93dfd478a 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -413,7 +413,7 @@  static int __sev_platform_init_locked(int *error)
 {
 	struct psp_device *psp = psp_master;
 	struct sev_device *sev;
-	int rc, psp_ret;
+	int rc, psp_ret = -1;
 	int (*init_function)(int *error);
 
 	if (!psp || !psp->sev_data)