On 8/15/24 07:25, Pavan Kumar Paluri wrote:
In case of sev PLATFORM_STATUS failure, sev_get_api_version() fails resulting in sev_data field of psp_master nulled out. This later becomes a problem when unloading the ccp module because the device has not been unregistered (via misc_deregister()) before clearing the sev_data field of psp_master. As a result, on reloading the ccp module, a duplicate device issue is encountered as can be seen from the dmesg log below.
on reloading ccp module via modprobe ccp
...
Address this issue by unregistering the /dev/sev before clearing out sev_data in case of PLATFORM_STATUS failure.
Fixes: 200664d5237f ("crypto: ccp: Add Secure Encrypted Virtualization (SEV) command support") Cc: stable@vger.kernel.org Signed-off-by: Pavan Kumar Paluri papaluri@amd.com
Acked-by: Tom Lendacky thomas.lendacky@amd.com