]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: ccp - Check for NULL PSP pointer at module unload
authorTom Lendacky <thomas.lendacky@amd.com>
Thu, 26 Jul 2018 14:37:59 +0000 (09:37 -0500)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 3 Aug 2018 10:06:05 +0000 (18:06 +0800)
commit27db745f69ed568cf8547bd3d51f7cfc734ac168
treee5d09fd0285a72defbdfb44c01c84e38fe0dbfdc
parent39e6f0fa35acb1059661fba08c5cc57dd5472e59
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: 49d7b59ed379 ("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>
drivers/crypto/ccp/psp-dev.c