mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-03-27 17:35:35 +00:00
crypto: ccp - During shutdown, check SEV data pointer before using
On shutdown, each CCP device instance performs shutdown processing.
However, __sev_platform_shutdown_locked() uses the controlling psp
structure to obtain the pointer to the sev_device structure. However,
during driver initialization, it is possible that an error can be received
from the firmware that results in the sev_data pointer being cleared from
the controlling psp structure. The __sev_platform_shutdown_locked()
function does not check for this situation and will segfault.
While not common, this scenario should be accounted for. Add a check for a
NULL sev_device structure before attempting to use it.
Fixes: 5441a07a12
("crypto: ccp - shutdown SEV firmware on kexec")
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
bffa1fc065
commit
1b05ece0c9
1 changed files with 1 additions and 1 deletions
|
@ -503,7 +503,7 @@ static int __sev_platform_shutdown_locked(int *error)
|
||||||
struct sev_device *sev = psp_master->sev_data;
|
struct sev_device *sev = psp_master->sev_data;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (sev->state == SEV_STATE_UNINIT)
|
if (!sev || sev->state == SEV_STATE_UNINIT)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ret = __sev_do_cmd_locked(SEV_CMD_SHUTDOWN, NULL, error);
|
ret = __sev_do_cmd_locked(SEV_CMD_SHUTDOWN, NULL, error);
|
||||||
|
|
Loading…
Add table
Reference in a new issue