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

crypto: stm32 - fix reference leak in stm32_crc_remove

pm_runtime_get_sync() will increment pm usage counter even it
failed. Forgetting to call pm_runtime_put_noidle will result
in reference leak in stm32_crc_remove, so we should fix it.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Zheng Yongjun and committed by
Herbert Xu
e9a36fee c8bd296c

+3 -1
+3 -1
drivers/crypto/stm32/stm32-crc32.c
··· 384 384 struct stm32_crc *crc = platform_get_drvdata(pdev); 385 385 int ret = pm_runtime_get_sync(crc->dev); 386 386 387 - if (ret < 0) 387 + if (ret < 0) { 388 + pm_runtime_put_noidle(crc->dev); 388 389 return ret; 390 + } 389 391 390 392 spin_lock(&crc_list.lock); 391 393 list_del(&crc->list);