LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] drivers/dma: fix reference count leaks in mmp_pdma_probe
@ 2021-09-11 7:05 Xin Xiong
2021-10-25 6:43 ` Vinod Koul
0 siblings, 1 reply; 2+ messages in thread
From: Xin Xiong @ 2021-09-11 7:05 UTC (permalink / raw)
To: Vinod Koul, dmaengine, linux-kernel
Cc: yuanxzhang, Xin Xiong, Xiyu Yang, Xin Tan
The issue happens in an error handling path. If
of_dma_controller_register() fails, the function simply prints error
messages and returns error code, without decrementing the reference
count of pdev->device incremented earlier by
dma_async_device_register(), which may result in refcount leaks.
Fix it by invoking dma_async_device_unregister() before returning the
error code.
Signed-off-by: Xin Xiong <xiongx18@fudan.edu.cn>
Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
---
drivers/dma/mmp_pdma.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
index 89f1814ff..a23563cd1 100644
--- a/drivers/dma/mmp_pdma.c
+++ b/drivers/dma/mmp_pdma.c
@@ -1123,6 +1123,7 @@ static int mmp_pdma_probe(struct platform_device *op)
mmp_pdma_dma_xlate, pdev);
if (ret < 0) {
dev_err(&op->dev, "of_dma_controller_register failed\n");
+ dma_async_device_unregister(&pdev->device);
return ret;
}
}
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers/dma: fix reference count leaks in mmp_pdma_probe
2021-09-11 7:05 [PATCH] drivers/dma: fix reference count leaks in mmp_pdma_probe Xin Xiong
@ 2021-10-25 6:43 ` Vinod Koul
0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2021-10-25 6:43 UTC (permalink / raw)
To: Xin Xiong; +Cc: dmaengine, linux-kernel, yuanxzhang, Xiyu Yang, Xin Tan
On 11-09-21, 15:05, Xin Xiong wrote:
> The issue happens in an error handling path. If
> of_dma_controller_register() fails, the function simply prints error
> messages and returns error code, without decrementing the reference
> count of pdev->device incremented earlier by
> dma_async_device_register(), which may result in refcount leaks.
>
> Fix it by invoking dma_async_device_unregister() before returning the
> error code.
Pls use right subsystem tag, git log will tell u the same. I have fixe
dit up while applying
--
~Vinod
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-25 6:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-11 7:05 [PATCH] drivers/dma: fix reference count leaks in mmp_pdma_probe Xin Xiong
2021-10-25 6:43 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).