Re: [PATCH v2] drm/i915/vma: Fix a memory leak in i915_vma_pin_ww()

From: Joonas Lahtinen

Date: Mon Nov 23 2026 - 03:49:23 EST


Quoting Haoxiang Li (2026-11-21 09:17:13)
> The memory allocated by i915_vma_work() is not freed if
> i915_gem_object_get_moving_fence() fails. Change the
> goto label to do so.

That's better.

You still did not touch the title of the patch, however.
If feedback is given to you, do not submit a new version
without confirming that you addressed all parts of it.
Consider this the last notice before getting ignored.

What you have is a memory leak on error path without any
assessment about if that error path is possible to hit.

Please realize your LLM is very eager to over-state
the impact of any findings. It's your responsibility to
understand the impact and write the commit description
and title accordingly.

> Fixes: 8ec5c0006c50 ("Merge tag 'drm-intel-next-2022-05-20' of git://anongit.freedesktop.org/drm/drm-intel into drm-intel-gt-next")

You should just re-create the merge conflict and check which
two patches conflicted. While it's within possibility that
the merge commit itself summoned the error handling code
from thin air as a trivial 'git blame' might show. It's not
very likely, so needs to be looked into.

Regards, Joonas

> Signed-off-by: Haoxiang Li <haoxiang_li2024@xxxxxxx>
> Reviewed-by: Andi Shyti <andi.shyti@xxxxxxxxxxxxxxx>
> ---
> Changes in v2:
> - Modify the commit message. Thanks, Andi!
> ---
> drivers/gpu/drm/i915/i915_vma.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
> index 16782d8579a8..4ba1c9ea5ecb 100644
> --- a/drivers/gpu/drm/i915/i915_vma.c
> +++ b/drivers/gpu/drm/i915/i915_vma.c
> @@ -1470,7 +1470,7 @@ int i915_vma_pin_ww(struct i915_vma *vma, struct i915_gem_ww_ctx *ww,
>
> err = i915_gem_object_get_moving_fence(vma->obj, &moving);
> if (err)
> - goto err_rpm;
> + goto err_fence;
>
> dma_fence_work_chain(&work->base, moving);
>
> --
> 2.25.1
>