[PATCH v6 01/39] mm/vma: fix mmap_prepare file handling, remove file_doesnt_need_get

Gregory Price (Meta) gourry at gourry.net
Tue Oct 20 14:47:04 PDT 2026


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 at google.com>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs at kernel.org>

Have a nit below, but otherwise

Reviewed-by: Gregory Price (Meta) <gourry at gourry.net>

> +static bool map_same_file(struct mmap_state *map)
> +{
> +	return map->vm_file == map->file;
> +}
>  

Terrible function name :]

~Gregory

-- 
Gregory Price (Meta) <gourry at gourry.net>



More information about the kvm-riscv mailing list