Re: [PATCH v2] crypto: ccp - Fix null pointer dereference in __sev_snp_shutdown_locked

From: Tom Lendacky
Date: Tue Jun 04 2024 - 17:37:11 EST


On 6/4/24 12:47, Kim Phillips wrote:
Fix a null pointer dereference induced by DEBUG_TEST_DRIVER_REMOVE.
Return from __sev_snp_shutdown_locked() if the psp_device or the
sev_device structs are not initialized. Without the fix, the driver will
produce the following splat:



Fixes: 1ca5614b84ee ("crypto: ccp: Add support to initialize the AMD-SP for SEV-SNP")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Kim Phillips <kim.phillips@xxxxxxx>
Reviewed-by: Liam Merwick <liam.merwick@xxxxxxxxxx>
Reviewed-by: Mario Limonciello <mario.limonciello@xxxxxxx>
Reviewed-by: John Allen <john.allen@xxxxxxx>

Reviewed-by: Tom Lendacky <thomas.lendacky@xxxxxxx>

---
v2:
- Correct the Fixes tag (Tom L.)
- Remove log timestamps, elaborate commit text (John Allen)
- Add Reviews-by.

v1:
- https://lore.kernel.org/linux-crypto/20240603151212.18342-1-kim.phillips@xxxxxxx/

drivers/crypto/ccp/sev-dev.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)