* [PATCH] remoteproc: core: fix potential memory leakage
@ 2021-10-15 12:40 Arnaud Pouliquen
2021-10-18 7:09 ` Arnaud POULIQUEN
0 siblings, 1 reply; 2+ messages in thread
From: Arnaud Pouliquen @ 2021-10-15 12:40 UTC (permalink / raw)
To: Bjorn Andersson, Ohad Ben-Cohen, Mathieu Poirier
Cc: linux-remoteproc, linux-kernel, linux-stm32, arnaud.pouliquen
If copy_dma_range_map returns an error, the rvdev structure must
be freed.
Fixes: e0d072782c73 ("dma-mapping: introduce DMA range map, supplanting dma_pfn_offset")
Suggested-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
---
drivers/remoteproc/remoteproc_core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 502b6604b757..aaa281c8fc82 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -557,8 +557,10 @@ static int rproc_handle_vdev(struct rproc *rproc, void *ptr,
snprintf(name, sizeof(name), "vdev%dbuffer", rvdev->index);
rvdev->dev.parent = &rproc->dev;
ret = copy_dma_range_map(&rvdev->dev, rproc->dev.parent);
- if (ret)
+ if (ret) {
+ kfree(rvdev);
return ret;
+ }
rvdev->dev.release = rproc_rvdev_release;
dev_set_name(&rvdev->dev, "%s#%s", dev_name(rvdev->dev.parent), name);
dev_set_drvdata(&rvdev->dev, rvdev);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] remoteproc: core: fix potential memory leakage
2021-10-15 12:40 [PATCH] remoteproc: core: fix potential memory leakage Arnaud Pouliquen
@ 2021-10-18 7:09 ` Arnaud POULIQUEN
0 siblings, 0 replies; 2+ messages in thread
From: Arnaud POULIQUEN @ 2021-10-18 7:09 UTC (permalink / raw)
To: Bjorn Andersson, Ohad Ben-Cohen, Mathieu Poirier
Cc: linux-remoteproc, linux-kernel, linux-stm32
On 10/15/21 2:40 PM, Arnaud Pouliquen wrote:
> If copy_dma_range_map returns an error, the rvdev structure must
> be freed.
>
> Fixes: e0d072782c73 ("dma-mapping: introduce DMA range map, supplanting dma_pfn_offset")
>
> Suggested-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Patch to ignore as already fixed by Christophe JAILLET
https://lore.kernel.org/all/163431847249.251657.11309404044031278395.b4-ty@linaro.org/T/
> ---
> drivers/remoteproc/remoteproc_core.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> index 502b6604b757..aaa281c8fc82 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -557,8 +557,10 @@ static int rproc_handle_vdev(struct rproc *rproc, void *ptr,
> snprintf(name, sizeof(name), "vdev%dbuffer", rvdev->index);
> rvdev->dev.parent = &rproc->dev;
> ret = copy_dma_range_map(&rvdev->dev, rproc->dev.parent);
> - if (ret)
> + if (ret) {
> + kfree(rvdev);
> return ret;
> + }
> rvdev->dev.release = rproc_rvdev_release;
> dev_set_name(&rvdev->dev, "%s#%s", dev_name(rvdev->dev.parent), name);
> dev_set_drvdata(&rvdev->dev, rvdev);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-18 7:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-15 12:40 [PATCH] remoteproc: core: fix potential memory leakage Arnaud Pouliquen
2021-10-18 7:09 ` Arnaud POULIQUEN
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).