lkml.org 
[lkml]   [2026]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 2/2] crypto/ccp: Skip SNP_INIT if preparation fails
Date
From: "Tycho Andersen (AMD)" <tycho@kernel.org>

If snp_prepare() failed SNP_INIT will fail, so skip it and return early.
Note that this is not a change in initialization behavior: if SNP_INIT
failed before this patch, it will still return an error
__sev_snp_init_locked() and fail initialization of other SEV modes.

Signed-off-by: Tycho Andersen (AMD) <tycho@kernel.org>
Reviewed-by: Nikunj A Dadhania <nikunj@amd.com>
---
drivers/crypto/ccp/sev-dev.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
index 939fa8aa155c..a37922d3d230 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -1374,7 +1374,9 @@ static int __sev_snp_init_locked(int *error, unsigned int max_snp_asid)
return -EOPNOTSUPP;
}

- snp_prepare();
+ rc = snp_prepare();
+ if (rc)
+ return rc;

/*
* Starting in SNP firmware v1.52, the SNP_INIT_EX command takes a list
--
2.53.0

\
 
 \ /
  Last update: 2026-04-09 21:56    [W:0.062 / U:8.710 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog