[PATCH v2 2/2] drm/i915/selftests: Do not leak vm_area_struct on early return

Krzysztof Karas krzysztof.karas at intel.com
Fri Aug 1 10:55:39 UTC 2025


Hi Andi,

> Hi Krzysztof,
> 
> On Wed, Jul 30, 2025 at 07:40:18AM +0000, Krzysztof Karas wrote:
> > This structure may be leaked on early failure paths, so include
> > vm_munmap() call in them to avoid that.
> 
> this commit message says nothing:
> 
>  - which structure?
>  - where does it leak?
>  - "in them" where?
>  - "avoid that" what?
> 
> You should consider that the person who reads the commit message
> doesn't know anything on what you are doing and he should be able
> to understand without reading the commit itself.
> 
> Reading the commit is necessary to understand the details of
> what's explained in the message.
> 
> No need to resend, but please reply to this email with a proper
> commit log.

I apologize for the inconvenience. The following hopefully
better describes my intentions with this patch:

"""
It is possible for the vm_area_struct to be leaked upon early
return from __igt_mmap_migrate(). The "addr" gets its value from
mapped memory by igt_mmap_offset(), but it is only released
inisde ___igt_mmap_migrate(). This means the execution must
successfully complete all the calls inbetween to have this area
unmapped, which is not guaranteed.

Amend the problem by moving unmapping vm_area_struct to the same
function where it is mapped and ensure unmapping is done when
error paths are taken.
"""

> 
> > Suggested-by: Chris Wilson <chris.p.wilson at linux.intel.com>
> > Signed-off-by: Krzysztof Karas <krzysztof.karas at intel.com>
> 
> Anyway, the patch is good:
> 
> Reviewed-by: Andi Shyti <andi.shyti at linux.intel.com>
> 
> Thanks,
> Andi

Thanks for the review!

-- 
Best Regards,
Krzysztof


More information about the Intel-gfx mailing list