]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: ccp - Cleanup misc_dev on sev_exit()
authorJohn Allen <john.allen@amd.com>
Tue, 3 Mar 2020 13:57:23 +0000 (07:57 -0600)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 12 Mar 2020 12:00:12 +0000 (23:00 +1100)
commitc856ec0f5f87540905a7827a33bc1aa13786ab7e
treea675171177195ece13b36c3b30c2f8cded38c348
parentab0e2de111553a41558c35565e38140283a04d02
crypto: ccp - Cleanup misc_dev on sev_exit()

Explicitly free and clear misc_dev in sev_exit(). Since devm_kzalloc()
associates misc_dev with the first device that gets probed, change from
devm_kzalloc() to kzalloc() and explicitly free memory in sev_exit() as
the first device probed is not guaranteed to be the last device released.
To ensure that the variable gets properly set to NULL, remove the local
definition of misc_dev.

Fixes: dd7fbb215982 ("crypto: ccp: Add Secure Encrypted Virtualization (SEV) command support")
Signed-off-by: John Allen <john.allen@amd.com>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ccp/sev-dev.c