Patch "crypto: ccp - During shutdown, check SEV data pointer before using" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    crypto: ccp - During shutdown, check SEV data pointer before using

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     crypto-ccp-during-shutdown-check-sev-data-pointer-be.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 30d310589b32ed9dba800128fefbf41df919738a
Author: Tom Lendacky <thomas.lendacky@xxxxxxx>
Date:   Thu Jun 16 10:26:18 2022 -0500

    crypto: ccp - During shutdown, check SEV data pointer before using
    
    [ Upstream commit 1b05ece0c931536c0a38a9385e243a7962e933f6 ]
    
    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: 5441a07a127f ("crypto: ccp - shutdown SEV firmware on kexec")
    Signed-off-by: Tom Lendacky <thomas.lendacky@xxxxxxx>
    Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
index 57b57d4db500..ed39a22e1b2b 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -278,7 +278,7 @@ static int __sev_platform_shutdown_locked(int *error)
 	struct sev_device *sev = psp_master->sev_data;
 	int ret;
 
-	if (sev->state == SEV_STATE_UNINIT)
+	if (!sev || sev->state == SEV_STATE_UNINIT)
 		return 0;
 
 	ret = __sev_do_cmd_locked(SEV_CMD_SHUTDOWN, NULL, error);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux