提交 3b3b7885 编写于 作者: S Shixin Liu 提交者: Zheng Zengkai

crypto: stm32/cryp - Fix PM reference leak on stm32-cryp.c

stable inclusion
from stable-5.10.36
commit 4e7ae0cfaca9ba57b6b10d4fe4d4bcefd9935db8
bugzilla: 51867
CVE: NA

--------------------------------

[ Upstream commit 747bf30f ]

pm_runtime_get_sync will increment pm usage counter even it failed.
Forgetting to putting operation will result in reference leak here.
Fix it by replacing it with pm_runtime_resume_and_get to keep usage
counter balanced.
Signed-off-by: NShixin Liu <liushixin2@huawei.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 2af9f750
......@@ -542,7 +542,7 @@ static int stm32_cryp_hw_init(struct stm32_cryp *cryp)
int ret;
u32 cfg, hw_mode;
pm_runtime_get_sync(cryp->dev);
pm_runtime_resume_and_get(cryp->dev);
/* Disable interrupt */
stm32_cryp_write(cryp, CRYP_IMSCR, 0);
......@@ -2043,7 +2043,7 @@ static int stm32_cryp_remove(struct platform_device *pdev)
if (!cryp)
return -ENODEV;
ret = pm_runtime_get_sync(cryp->dev);
ret = pm_runtime_resume_and_get(cryp->dev);
if (ret < 0)
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册