* [PATCH] crypto: ccp - Ignore unconfigured CCP device on suspend/resume
@ 2019-08-19 22:23 Hook, Gary
2019-08-22 5:55 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Hook, Gary @ 2019-08-19 22:23 UTC (permalink / raw)
To: linux-crypto; +Cc: herbert, davem, Lendacky, Thomas, Hook, Gary
From: Gary R Hook <gary.hook@amd.com>
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 <gary.hook@amd.com>
---
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 e58d69d4dd43..73acf0fdb793 100644
--- a/drivers/crypto/ccp/ccp-dev.c
+++ b/drivers/crypto/ccp/ccp-dev.c
@@ -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;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: ccp - Ignore unconfigured CCP device on suspend/resume
2019-08-19 22:23 [PATCH] crypto: ccp - Ignore unconfigured CCP device on suspend/resume Hook, Gary
@ 2019-08-22 5:55 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2019-08-22 5:55 UTC (permalink / raw)
To: Hook, Gary; +Cc: linux-crypto, davem, Lendacky, Thomas
On Mon, Aug 19, 2019 at 10:23:27PM +0000, Hook, Gary wrote:
> From: Gary R Hook <gary.hook@amd.com>
>
> 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 <gary.hook@amd.com>
> ---
> drivers/crypto/ccp/ccp-dev.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-22 5:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-19 22:23 [PATCH] crypto: ccp - Ignore unconfigured CCP device on suspend/resume Hook, Gary
2019-08-22 5:55 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).