Re: [PATCH v6 01/39] mm/vma: fix mmap_prepare file handling, remove file_doesnt_need_get
From: Gregory Price (Meta)
Date: Tue Oct 20 2026 - 17:50:34 EST
On 2026-10-13 16:04 +0100, Lorenzo Stoakes (ARM) wrote:
> The map->file_doesnt_need_get flag is confusing and the existing
> implementation has holes.
>
> Drivers are permitted to change the owning file of a mapping. If they do
> so, they are required to take a reference on that file.
>
> The mmap() operation which ultimately invokes __mmap_region() is guaranteed
> to drop the refcount for the original file the mapping was made under, but
> this is not true for the replaced file.
>
...
>
> Reviewed-by: Suren Baghdasaryan <surenb@xxxxxxxxxx>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
Have a nit below, but otherwise
Reviewed-by: Gregory Price (Meta) <gourry@xxxxxxxxxx>
> +static bool map_same_file(struct mmap_state *map)
> +{
> + return map->vm_file == map->file;
> +}
>
Terrible function name :]
~Gregory
--
Gregory Price (Meta) <gourry@xxxxxxxxxx>