From: Mark-PK Tsai via iommu <iommu@lists.linux-foundation.org>
To: <bjorn.andersson@linaro.org>, <mathieu.poirier@linaro.org>,
<robin.murphy@arm.com>
Cc: yj.chiang@mediatek.com, linux-remoteproc@vger.kernel.org,
linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
linux-mediatek@lists.infradead.org, mark-pk.tsai@mediatek.com,
matthias.bgg@gmail.com, hch@lst.de,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] remoteproc: Fix dma_mem leak after rproc_shutdown
Date: Fri, 22 Apr 2022 14:24:36 +0800 [thread overview]
Message-ID: <20220422062436.14384-3-mark-pk.tsai@mediatek.com> (raw)
In-Reply-To: <20220422062436.14384-1-mark-pk.tsai@mediatek.com>
Release dma coherent memory before rvdev is free in
rproc_rvdev_release().
Below is the kmemleak report:
unreferenced object 0xffffff8051c1a980 (size 128):
comm "sh", pid 4895, jiffies 4295026604 (age 15481.896s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<000000003a0f3ec0>] dma_declare_coherent_memory+0x44/0x11c
[<00000000ad243164>] rproc_add_virtio_dev+0xb8/0x20c
[<00000000d219c8e9>] rproc_vdev_do_start+0x18/0x24
[<00000000e694b468>] rproc_start+0x22c/0x3e0
[<000000000b938941>] rproc_boot+0x4a4/0x860
[<000000003c4dc532>] state_store.52856+0x10c/0x1b8
[<00000000df2297ac>] dev_attr_store+0x34/0x84
[<0000000083a53bdb>] sysfs_kf_write+0x60/0xbc
[<000000008ed830df>] kernfs_fop_write+0x198/0x458
[<0000000072b9ad06>] __vfs_write+0x50/0x210
[<00000000377d7469>] vfs_write+0xe4/0x1a8
[<00000000c3fc594e>] ksys_write+0x78/0x144
[<000000009aef6f4b>] __arm64_sys_write+0x1c/0x28
[<0000000003496a98>] el0_svc_common+0xc8/0x22c
[<00000000ea3fe7a3>] el0_svc_compat_handler+0x1c/0x28
[<00000000d1a85a4e>] el0_svc_compat+0x8/0x24
Signed-off-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
---
drivers/remoteproc/remoteproc_core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index c510125769b9..8e28290eefa9 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -461,6 +461,7 @@ static void rproc_rvdev_release(struct device *dev)
struct rproc_vdev *rvdev = container_of(dev, struct rproc_vdev, dev);
of_reserved_mem_device_release(dev);
+ dma_release_coherent_memory(dev);
kfree(rvdev);
}
--
2.18.0
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2022-04-22 14:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-22 6:24 [PATCH 0/2] dma-mapping, remoteproc: Fix dma_mem leak after rproc_shutdown Mark-PK Tsai via iommu
2022-04-22 6:24 ` [PATCH 1/2] dma-mapping: Add dma_release_coherent_memory to DMA API Mark-PK Tsai via iommu
2022-04-22 6:24 ` Mark-PK Tsai via iommu [this message]
2022-04-23 17:46 ` [PATCH 0/2] dma-mapping, remoteproc: Fix dma_mem leak after rproc_shutdown Christoph Hellwig
2022-05-23 10:15 ` Mark-PK Tsai via iommu
2022-05-23 10:24 ` Robin Murphy
2022-05-23 12:27 ` Mark-PK Tsai via iommu
2022-06-22 16:25 ` Mathieu Poirier
2022-06-23 5:42 ` Christoph Hellwig
2022-06-24 16:48 ` Mathieu Poirier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220422062436.14384-3-mark-pk.tsai@mediatek.com \
--to=iommu@lists.linux-foundation.org \
--cc=bjorn.andersson@linaro.org \
--cc=hch@lst.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mark-pk.tsai@mediatek.com \
--cc=mathieu.poirier@linaro.org \
--cc=matthias.bgg@gmail.com \
--cc=robin.murphy@arm.com \
--cc=yj.chiang@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox