提交 10d8d54a 编写于 作者: W Wang Li 提交者: Zheng Zengkai

spi: qup: fix PM reference leak in spi_qup_remove()

stable inclusion
from stable-5.10.36
commit 0e73535a496c6c52e56137a61e2476368d7aec52
bugzilla: 51867
CVE: NA

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

[ Upstream commit cec77e0a ]

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.
Reported-by: NHulk Robot <hulkci@huawei.com>
Signed-off-by: NWang Li <wangli74@huawei.com>
Reviewed-by: NManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20210409095458.29921-1-wangli74@huawei.comSigned-off-by: NMark Brown <broonie@kernel.org>
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>
上级 159f5664
...@@ -1263,7 +1263,7 @@ static int spi_qup_remove(struct platform_device *pdev) ...@@ -1263,7 +1263,7 @@ static int spi_qup_remove(struct platform_device *pdev)
struct spi_qup *controller = spi_master_get_devdata(master); struct spi_qup *controller = spi_master_get_devdata(master);
int ret; int ret;
ret = pm_runtime_get_sync(&pdev->dev); ret = pm_runtime_resume_and_get(&pdev->dev);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册