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>
---
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(-)