> 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. > > This has been addressed so far by tracking map->file_doesnt_need_get, which > is rather poorly named and unfortunately fails to correctly track whether > or not an additional put were needed in a number of cases. > > Make life easier by removing this flag, and instead drop the reference for > [ ... ] > No in-tree driver is impacted by the incorrect implementation of this > currently (no driver that does this is mergeable for one), so this does not > need to be a fix. > > Signed-off-by: Lorenzo Stoakes (ARM) <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review ยท https://sashiko.dev/#/patchset/20260914-b4-mmap-prepare-vma-flag-sanify-v2-0-7d9781ed5...@kernel.org?part=1
