This Linux kernel change "crypto: ccp – Ignore unconfigured CCP device on suspend/resume" is included in the Linux 4.19.70 release. This change is authored by Gary R Hook <gary.hook [at] amd.com> on Mon Aug 19 22:23:27 2019 +0000. The commit for this change in Linux stable tree is 690a424 (patch) which is from upstream commit 5871cd9. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 5871cd9.
crypto: ccp - Ignore unconfigured CCP device on suspend/resume commit 5871cd93692c8071fb9358daccb715b5081316ac upstream. If a CCP is unconfigured (e.g. there are no available queues) then there will be no data structures allocated for the device. Thus, we must check for validity of a pointer before trying to access structure members. Fixes: 720419f01832f ("crypto: ccp - Introduce the AMD Secure Processor device") Cc: <email@example.com> Signed-off-by: Gary R Hook <firstname.lastname@example.org> Signed-off-by: Herbert Xu <email@example.com> Signed-off-by: Greg Kroah-Hartman <firstname.lastname@example.org>
There are 8 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.
drivers/crypto/ccp/ccp-dev.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c index 9b6d897..b8c94a0 100644 --- a/drivers/crypto/ccp/ccp-dev.c +++ b/drivers/crypto/ccp/ccp-dev.c @@ -543,6 +543,10 @@ int ccp_dev_suspend(struct sp_device *sp, pm_message_t state) unsigned long flags; unsigned int i; + /* If there's no device there's nothing to do */ + if (!ccp) + return 0; + spin_lock_irqsave(&ccp->cmd_lock, flags); ccp->suspending = 1; @@ -567,6 +571,10 @@ int ccp_dev_resume(struct sp_device *sp) unsigned long flags; unsigned int i; + /* If there's no device there's nothing to do */ + if (!ccp) + return 0; + spin_lock_irqsave(&ccp->cmd_lock, flags); ccp->suspending = 0;