提交 2bbf8c21 编写于 作者: S Shixin Liu 提交者: Zheng Zengkai

crypto: omap-aes - Fix PM reference leak on omap-aes.c

stable inclusion
from stable-5.10.36
commit 5d60792d129277af284a1804b929ff482201e5f0
bugzilla: 51867
CVE: NA

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

[ Upstream commit 1f34cc4a ]

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>
上级 eb92569a
...@@ -103,7 +103,7 @@ static int omap_aes_hw_init(struct omap_aes_dev *dd) ...@@ -103,7 +103,7 @@ static int omap_aes_hw_init(struct omap_aes_dev *dd)
dd->err = 0; dd->err = 0;
} }
err = pm_runtime_get_sync(dd->dev); err = pm_runtime_resume_and_get(dd->dev);
if (err < 0) { if (err < 0) {
dev_err(dd->dev, "failed to get sync: %d\n", err); dev_err(dd->dev, "failed to get sync: %d\n", err);
return err; return err;
...@@ -1133,7 +1133,7 @@ static int omap_aes_probe(struct platform_device *pdev) ...@@ -1133,7 +1133,7 @@ static int omap_aes_probe(struct platform_device *pdev)
pm_runtime_set_autosuspend_delay(dev, DEFAULT_AUTOSUSPEND_DELAY); pm_runtime_set_autosuspend_delay(dev, DEFAULT_AUTOSUSPEND_DELAY);
pm_runtime_enable(dev); pm_runtime_enable(dev);
err = pm_runtime_get_sync(dev); err = pm_runtime_resume_and_get(dev);
if (err < 0) { if (err < 0) {
dev_err(dev, "%s: failed to get_sync(%d)\n", dev_err(dev, "%s: failed to get_sync(%d)\n",
__func__, err); __func__, err);
...@@ -1302,7 +1302,7 @@ static int omap_aes_suspend(struct device *dev) ...@@ -1302,7 +1302,7 @@ static int omap_aes_suspend(struct device *dev)
static int omap_aes_resume(struct device *dev) static int omap_aes_resume(struct device *dev)
{ {
pm_runtime_get_sync(dev); pm_runtime_resume_and_get(dev);
return 0; return 0;
} }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册