[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <956110cf-d309-430c-b30f-a9c442e015cf@linaro.org>
Date: Sat, 16 Aug 2025 11:15:23 +0100
From: Bryan O'Donoghue <bryan.odonoghue@...aro.org>
To: Dikshita Agarwal <quic_dikshita@...cinc.com>,
Vikash Garodia <quic_vgarodia@...cinc.com>,
Abhinav Kumar <abhinav.kumar@...ux.dev>,
Mauro Carvalho Chehab <mchehab@...nel.org>, Hans Verkuil
<hverkuil@...all.nl>, Stefan Schmidt <stefan.schmidt@...aro.org>,
Vedang Nagar <quic_vnagar@...cinc.com>
Cc: linux-media@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org, Renjiang Han <quic_renjiang@...cinc.com>,
Wangao Wang <quic_wangaow@...cinc.com>
Subject: Re: [PATCH v2 03/24] media: iris: Fix memory leak by freeing
untracked persist buffer
On 13/08/2025 10:37, Dikshita Agarwal wrote:
> One internal buffer which is allocated only once per session was not
> being freed during session close because it was not being tracked as
> part of internal buffer list which resulted in a memory leak.
>
> Add the necessary logic to explicitly free the untracked internal buffer
> during session close to ensure all allocated memory is released
> properly.
>
> Fixes: 73702f45db81 ("media: iris: allocate, initialize and queue internal buffers")
> Reviewed-by: Vikash Garodia <quic_vgarodia@...cinc.com>
> Tested-by: Vikash Garodia <quic_vgarodia@...cinc.com> # X1E80100
> Signed-off-by: Dikshita Agarwal <quic_dikshita@...cinc.com>
> ---
> drivers/media/platform/qcom/iris/iris_buffer.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/media/platform/qcom/iris/iris_buffer.c b/drivers/media/platform/qcom/iris/iris_buffer.c
> index 6425e4919e3b0b849ba801ca9e01921c114144cd..9f664c241149362d44d3a8fa65e2266f9c2e80e0 100644
> --- a/drivers/media/platform/qcom/iris/iris_buffer.c
> +++ b/drivers/media/platform/qcom/iris/iris_buffer.c
> @@ -413,6 +413,16 @@ static int iris_destroy_internal_buffers(struct iris_inst *inst, u32 plane, bool
> }
> }
>
> + if (force) {
> + buffers = &inst->buffers[BUF_PERSIST];
> +
> + list_for_each_entry_safe(buf, next, &buffers->list, list) {
> + ret = iris_destroy_internal_buffer(inst, buf);
> + if (ret)
> + return ret;
> + }
> + }
> +
> return 0;
> }
>
>
Why is the logic here not to simply release every index of the enum
iris_buffer_type ?
If I'm reading the code right here, len indicates the list of linked
lists to free, adding BUF_PERSIST appends to the list that may be freed
if force is true but, then what about the remaining entries BUF_SCRATCH_1 ?
Is it valid to leave this routine with force = true but BUF_SCRATCH_1
not specifically indexed, if so why ?
---
bod
Powered by blists - more mailing lists