Re: [PATCH v3 01/40] mm/vma: fix mmap_prepare file handling, remove file_doesnt_need_get
From: Gregory Price
Date: Thu Sep 24 2026 - 13:13:48 EST
On Thu, Sep 17, 2026 at 05:22:10PM +0100, Lorenzo Stoakes (ARM) wrote:
> +static void put_map(struct mmap_state *map)
> +{
...
> + if (map->vm_file && !map_same_file(map))
> + fput(map->vm_file);
...
> diff --git a/mm/vma.h b/mm/vma.h
> index e97bd2dfa786..f15faa83f3d6 100644
> --- a/mm/vma.h
> +++ b/mm/vma.h
> @@ -394,8 +394,10 @@ static inline void compat_set_vma_from_desc(struct vm_area_struct *vma,
>
> + if (desc->vm_file != vma->vm_file) {
> + fput(vma->vm_file);
Sashiko pointed out that this could be null if the vma is "anonymized".
Previously we'd discussed that anonymizing a file folio is more of a
wart than a feature, and IIRC you intended to remove that (i think?)
when you removed zero-file mapping "anonymization" so some of this VMA
stuff could be detangled.
If this is an intermediate state, do we still need to manage this NULL
scenario, and when we drop the anonymization mechanism we add a WARN()
that says someone is being naughty?
~Gregory