mirror of
https://github.com/torvalds/linux.git
synced 2024-12-20 10:01:56 +00:00
crypto: ccp - Ignore unconfigured CCP device on suspend/resume
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: 720419f018
("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>
This commit is contained in:
parent
e2664ecbb2
commit
5871cd9369
@ -540,6 +540,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;
|
||||
@ -564,6 +568,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;
|
||||
|
Loading…
Reference in New Issue
Block a user