Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Jack Wang <jinpu.wang@ionos.com>
To: gregkh@linuxfoundation.org, sashal@kernel.org, stable@vger.kernel.org
Cc: dmitrii.omelchenko@cloud.ionos.com,
	Michael Roth <michael.roth@amd.com>,
	Diego GonzalezVillalobos <Diego.GonzalezVillalobos@amd.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Jack Wang <jinpu.wang@cloud.ionos.com>
Subject: [stable-6.12 3/4] crypto: ccp - Fix checks for SNP_VLEK_LOAD input buffer length
Date: Fri, 14 Aug 2026 12:02:56 +0200	[thread overview]
Message-ID: <20260814100652.225499-4-jinpu.wang@ionos.com> (raw)
In-Reply-To: <20260814100652.225499-1-jinpu.wang@ionos.com>

From: Michael Roth <michael.roth@amd.com>

commit ed53a5050f42a3243a7ed8dfa49030e54034b952 upstream.

The SNP_VLEK_LOAD IOCTL currently fails due to sev_cmd_buffer_len()
returning the default expected buffer length of 0 instead of the correct
value, which would be sizeof(struct sev_user_data_snp_vlek_load). Add
specific handling for SNP_VLEK_LOAD so the correct expected size is
returned.

Reported-by: Diego GonzalezVillalobos <Diego.GonzalezVillalobos@amd.com>
Cc: Diego GonzalezVillalobos <Diego.GonzalezVillalobos@amd.com>
Fixes: 332d2c1d713e ("crypto: ccp: Add the SNP_VLEK_LOAD command")
Signed-off-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[Jack: sev_cmd_buffer_len() in queue/6.12 does not yet have the
 SEV_CMD_SNP_FEATURE_INFO case the upstream context line matched
 against (it lands in a later, unrelated commit not queued here),
 so the new SEV_CMD_SNP_VLEK_LOAD case was placed directly after
 SEV_CMD_SNP_COMMIT instead. No functional difference from upstream.]
Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
---
 drivers/crypto/ccp/sev-dev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
index 7c05cae7e577..6e08378eb5fa 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -226,6 +226,7 @@ static int sev_cmd_buffer_len(int cmd)
 	case SEV_CMD_SNP_GUEST_REQUEST:		return sizeof(struct sev_data_snp_guest_request);
 	case SEV_CMD_SNP_CONFIG:		return sizeof(struct sev_user_data_snp_config);
 	case SEV_CMD_SNP_COMMIT:		return sizeof(struct sev_data_snp_commit);
+	case SEV_CMD_SNP_VLEK_LOAD:		return sizeof(struct sev_user_data_snp_vlek_load);
 	default:				return 0;
 	}
 
-- 
2.43.0


  parent reply	other threads:[~2026-08-14 10:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 10:02 [PATCH 6.12.y 0/4] crypto: ccp, KVM: SVM - missing SEV/SNP platform-init dependency + 2 bugfixes Jack Wang
2026-08-14 10:02 ` [stable-6.12 1/4] crypto: ccp - Add new SEV/SNP platform shutdown API Jack Wang
2026-08-14 10:02 ` [stable-6.12 2/4] KVM: SVM: Add support to initialize SEV/SNP functionality in KVM Jack Wang
2026-08-14 14:40   ` Sean Christopherson
2026-08-14 10:02 ` Jack Wang [this message]
2026-08-14 10:02 ` [stable-6.12 4/4] crypto: ccp - Abort doing SEV INIT if SNP INIT fails Jack Wang
2026-08-15  2:33 ` [PATCH 6.12.y 0/4] crypto: ccp, KVM: SVM - missing SEV/SNP platform-init dependency + 2 bugfixes Sasha Levin
2026-08-17  4:51   ` Jinpu Wang
2026-08-17  5:00     ` Greg KH
2026-08-17  5:22       ` Jinpu Wang
2026-08-17  5:34         ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260814100652.225499-4-jinpu.wang@ionos.com \
    --to=jinpu.wang@ionos.com \
    --cc=Diego.GonzalezVillalobos@amd.com \
    --cc=dmitrii.omelchenko@cloud.ionos.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=jinpu.wang@cloud.ionos.com \
    --cc=michael.roth@amd.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox