* [PATCH] crypto: ccp: Fix checks for SNP_VLEK_LOAD input buffer length
@ 2025-07-28 23:43 Michael Roth
2025-08-05 18:05 ` Borislav Petkov
0 siblings, 1 reply; 2+ messages in thread
From: Michael Roth @ 2025-07-28 23:43 UTC (permalink / raw)
To: x86; +Cc: linux-kernel, linux-crypto, Diego GonzalezVillalobos
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>
---
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 3451bada884e..7843973ba4c6 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -233,6 +233,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.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: ccp: Fix checks for SNP_VLEK_LOAD input buffer length
2025-07-28 23:43 [PATCH] crypto: ccp: Fix checks for SNP_VLEK_LOAD input buffer length Michael Roth
@ 2025-08-05 18:05 ` Borislav Petkov
0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2025-08-05 18:05 UTC (permalink / raw)
To: Michael Roth, Herbert Xu
Cc: x86, linux-kernel, linux-crypto, Diego GonzalezVillalobos
I think this should go to Herbert who's collecting crypto stuff.
To: x86@kernel.org is perhaps not really the right place :)
On Mon, Jul 28, 2025 at 06:43:03PM -0500, Michael Roth wrote:
> 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>
> ---
> 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 3451bada884e..7843973ba4c6 100644
> --- a/drivers/crypto/ccp/sev-dev.c
> +++ b/drivers/crypto/ccp/sev-dev.c
> @@ -233,6 +233,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.25.1
>
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-05 18:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-28 23:43 [PATCH] crypto: ccp: Fix checks for SNP_VLEK_LOAD input buffer length Michael Roth
2025-08-05 18:05 ` Borislav Petkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).