Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: aspeed - fix double free caused by devm

The clock obtained via devm_clk_get_enabled() is automatically managed
by devres and will be disabled and freed on driver detach. Manually
calling clk_disable_unprepare() in error path and remove function
causes double free.

Remove the manual clock cleanup in both aspeed_acry_probe()'s error
path and aspeed_acry_remove().

Fixes: 2f1cf4e50c95 ("crypto: aspeed - Add ACRY RSA driver")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Haotian Zhang and committed by
Herbert Xu
3c9bf72c 3ac2939b

-2
-2
drivers/crypto/aspeed/aspeed-acry.c
··· 787 787 err_engine_rsa_start: 788 788 crypto_engine_exit(acry_dev->crypt_engine_rsa); 789 789 clk_exit: 790 - clk_disable_unprepare(acry_dev->clk); 791 790 792 791 return rc; 793 792 } ··· 798 799 aspeed_acry_unregister(acry_dev); 799 800 crypto_engine_exit(acry_dev->crypt_engine_rsa); 800 801 tasklet_kill(&acry_dev->done_task); 801 - clk_disable_unprepare(acry_dev->clk); 802 802 } 803 803 804 804 MODULE_DEVICE_TABLE(of, aspeed_acry_of_matches);