]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cramfs: fix incorrect physical page address calculation
authorAlistair Popple <apopple@nvidia.com>
Tue, 23 Sep 2025 00:53:33 +0000 (10:53 +1000)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 28 Sep 2025 18:36:12 +0000 (11:36 -0700)
Commit 21aa65bf82a7 ("mm: remove callers of pfn_t functionality")
incorrectly replaced the pfn with the physical address when calling
vmf_insert_mixed().  Instead the phys_to_pfn_t() call should have been
replaced with PHYS_PFN().

Found by inspection after a similar issue was noted in fuse virtio_fs.

Link: https://lkml.kernel.org/r/20250923005333.3165032-1-apopple@nvidia.com
Fixes: 21aa65bf82a7 ("mm: remove callers of pfn_t functionality")
Signed-off-by: Alistair Popple <apopple@nvidia.com>
Reviewed-by: Dev Jain <dev.jain@arm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Cc: Haiyue Wang <haiyuewa@163.com>
Cc: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/cramfs/inode.c

index b002e9b734f99cf9aca3b639f1e35c7af2c68935..56c8005b24a34422cbd3aa38cc8940a3fe7b2421 100644 (file)
@@ -412,7 +412,7 @@ static int cramfs_physmem_mmap(struct file *file, struct vm_area_struct *vma)
                        vm_fault_t vmf;
                        unsigned long off = i * PAGE_SIZE;
                        vmf = vmf_insert_mixed(vma, vma->vm_start + off,
-                                       address + off);
+                                       PHYS_PFN(address + off));
                        if (vmf & VM_FAULT_ERROR)
                                ret = vm_fault_to_errno(vmf, 0);
                }