]> www.infradead.org Git - users/dwmw2/linux.git/commit
virt: sev-guest: Allocate request data dynamically
authorNikunj A Dadhania <nikunj@amd.com>
Thu, 6 Mar 2025 08:17:21 +0000 (19:17 +1100)
committerBorislav Petkov (AMD) <bp@alien8.de>
Fri, 7 Mar 2025 12:34:25 +0000 (13:34 +0100)
commitac7c06acaa3738b38e83815ac0f07140ad320f13
tree26835ef7d2ce8d93503458fd13334586d86d0325
parent14cb5d83068ecf15d2da6f7d0e9ea9edbcbc0457
virt: sev-guest: Allocate request data dynamically

Commit

  ae596615d93d ("virt: sev-guest: Reduce the scope of SNP command mutex")

narrowed the command mutex scope to snp_send_guest_request().  However,
GET_REPORT, GET_DERIVED_KEY, and GET_EXT_REPORT share the req structure in
snp_guest_dev. Without the mutex protection, concurrent requests can overwrite
each other's data. Fix it by dynamically allocating the request structure.

Fixes: ae596615d93d ("virt: sev-guest: Reduce the scope of SNP command mutex")
Closes: https://github.com/AMDESE/AMDSEV/issues/265
Reported-by: andreas.stuehrk@yaxi.tech
Signed-off-by: Nikunj A Dadhania <nikunj@amd.com>
Signed-off-by: Alexey Kardashevskiy <aik@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20250307013700.437505-2-aik@amd.com
drivers/virt/coco/sev-guest/sev-guest.c