diff options
author | Gary R Hook <gary.hook@amd.com> | 2019-08-19 22:23:27 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-09-06 10:22:21 +0200 |
commit | 690a424838ca3b5a8fc884fb0055a93aab781e7d (patch) | |
tree | 460e959b32af50f7883e310ea58698e961cf2df4 /drivers/crypto | |
parent | 4e77b2ea941b3a3d5aea682528f56e94c9b2da4e (diff) | |
download | linux-stable-690a424838ca3b5a8fc884fb0055a93aab781e7d.tar.gz linux-stable-690a424838ca3b5a8fc884fb0055a93aab781e7d.tar.bz2 linux-stable-690a424838ca3b5a8fc884fb0055a93aab781e7d.zip |
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: <stable@vger.kernel.org>
Signed-off-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/ccp/ccp-dev.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c index 9b6d8972a565..b8c94a01cfc9 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; |