[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <693c7823-9edb-f821-1573-3bb01948253f@gmail.com>
Date: Fri, 8 Apr 2022 10:18:24 +0800
From: Hangyu Hua <hbh25y@...il.com>
To: jacob-chen@...wrt.com, ezequiel@...guardiasur.com.ar,
mchehab@...nel.org, heiko@...ech.de
Cc: linux-media@...r.kernel.org, linux-rockchip@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: rga: fix possible memory leak in rga_probe
Gentle ping.
On 2022/3/24 16:37, Hangyu Hua wrote:
> rga->m2m_dev needs to be freed when rga_probe fails.
>
> Signed-off-by: Hangyu Hua <hbh25y@...il.com>
> ---
> drivers/media/platform/rockchip/rga/rga.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c
> index 4de5e8d2b261..c2ce4fdcdb7f 100644
> --- a/drivers/media/platform/rockchip/rga/rga.c
> +++ b/drivers/media/platform/rockchip/rga/rga.c
> @@ -865,7 +865,7 @@ static int rga_probe(struct platform_device *pdev)
>
> ret = pm_runtime_resume_and_get(rga->dev);
> if (ret < 0)
> - goto rel_vdev;
> + goto rel_m2m;
>
> rga->version.major = (rga_read(rga, RGA_VERSION_INFO) >> 24) & 0xFF;
> rga->version.minor = (rga_read(rga, RGA_VERSION_INFO) >> 20) & 0x0F;
> @@ -881,7 +881,7 @@ static int rga_probe(struct platform_device *pdev)
> DMA_ATTR_WRITE_COMBINE);
> if (!rga->cmdbuf_virt) {
> ret = -ENOMEM;
> - goto rel_vdev;
> + goto rel_m2m;
> }
>
> rga->src_mmu_pages =
> @@ -918,6 +918,8 @@ static int rga_probe(struct platform_device *pdev)
> free_dma:
> dma_free_attrs(rga->dev, RGA_CMDBUF_SIZE, rga->cmdbuf_virt,
> rga->cmdbuf_phy, DMA_ATTR_WRITE_COMBINE);
> +rel_m2m:
> + v4l2_m2m_release(rga->m2m_dev);
> rel_vdev:
> video_device_release(vfd);
> unreg_v4l2_dev:
Powered by blists - more mailing lists