crypto: ccp - Ignore unconfigured CCP device on suspend/resume
Subsystems (2)
PATCH 1/1 crypto: ccp - Ignore unconfigured CCP device on suspend/resume
From: Gary R Hook <[email protected]>
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")
Signed-off-by Gary R Hook <[email protected]>
--- drivers/crypto/ccp/ccp-dev.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/crypto/ccp/ccp-dev.c +8 -0
@@ -555,6 +555,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 ;
@@ -579,6 +583,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 ;
Signature · 1 line
2.17.1
Herbert Xu
maintainerQuoted 7 lines · Gary
From: Gary R Hook <[email protected]>
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.
Quoted 6 lines
Fixes 720419f01832f ("crypto: ccp - Introduce the AMD Secure Processor device")Signed-off-by Gary R Hook <[email protected]>--- drivers/crypto/ccp/ccp-dev.c | 8 ++++++++ 1 file changed, 8 insertions(+)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt