aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71-e3000/0126-crypto-ccp-Check-for-NULL-PSP-pointer-at-module-unlo.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71-e3000/0126-crypto-ccp-Check-for-NULL-PSP-pointer-at-module-unlo.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71-e3000/0126-crypto-ccp-Check-for-NULL-PSP-pointer-at-module-unlo.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71-e3000/0126-crypto-ccp-Check-for-NULL-PSP-pointer-at-module-unlo.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71-e3000/0126-crypto-ccp-Check-for-NULL-PSP-pointer-at-module-unlo.patch
new file mode 100644
index 00000000..07ab1590
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71-e3000/0126-crypto-ccp-Check-for-NULL-PSP-pointer-at-module-unlo.patch
@@ -0,0 +1,41 @@
+From cef326f0d3dcb0789fccce84be1777fb102e2694 Mon Sep 17 00:00:00 2001
+From: Tom Lendacky <thomas.lendacky@amd.com>
+Date: Thu, 26 Jul 2018 09:37:59 -0500
+Subject: [PATCH 126/131] crypto: ccp - Check for NULL PSP pointer at module
+ unload
+
+Should the PSP initialization fail, the PSP data structure will be
+freed and the value contained in the sp_device struct set to NULL.
+At module unload, psp_dev_destroy() does not check if the pointer
+value is NULL and will end up dereferencing a NULL pointer.
+
+Add a pointer check of the psp_data field in the sp_device struct
+in psp_dev_destroy() and return immediately if it is NULL.
+
+Cc: <stable@vger.kernel.org> # 4.16.x-
+Fixes: 2a6170dfe755 ("crypto: ccp: Add Platform Security Processor (PSP) device support")
+Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
+Acked-by: Gary R Hook <gary.hook@amd.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
+---
+ drivers/crypto/ccp/psp-dev.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c
+index 9b59638..218739b 100644
+--- a/drivers/crypto/ccp/psp-dev.c
++++ b/drivers/crypto/ccp/psp-dev.c
+@@ -858,6 +858,9 @@ void psp_dev_destroy(struct sp_device *sp)
+ {
+ struct psp_device *psp = sp->psp_data;
+
++ if (!psp)
++ return;
++
+ if (psp->sev_misc)
+ kref_put(&misc_dev->refcount, sev_exit);
+
+--
+2.7.4
+