linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cramfs: Fix incorrect physical page address calculation
@ 2025-09-23  0:53 Alistair Popple
  2025-09-23  6:56 ` Dev Jain
  2025-09-23  7:38 ` David Hildenbrand
  0 siblings, 2 replies; 3+ messages in thread
From: Alistair Popple @ 2025-09-23  0:53 UTC (permalink / raw)
  To: linux-fsdevel, linux-mm, akpm
  Cc: Alistair Popple, Haiyue Wang, David Hildenbrand, Nicolas Pitre

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.

Fixes: 21aa65bf82a7 ("mm: remove callers of pfn_t functionality")
Signed-off-by: Alistair Popple <apopple@nvidia.com>

Cc: Haiyue Wang <haiyuewa@163.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Nicolas Pitre <nico@fluxnic.net>
---
 fs/cramfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index b002e9b734f9..56c8005b24a3 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -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);
 		}
-- 
2.50.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cramfs: Fix incorrect physical page address calculation
  2025-09-23  0:53 [PATCH] cramfs: Fix incorrect physical page address calculation Alistair Popple
@ 2025-09-23  6:56 ` Dev Jain
  2025-09-23  7:38 ` David Hildenbrand
  1 sibling, 0 replies; 3+ messages in thread
From: Dev Jain @ 2025-09-23  6:56 UTC (permalink / raw)
  To: Alistair Popple, linux-fsdevel, linux-mm, akpm
  Cc: Haiyue Wang, David Hildenbrand, Nicolas Pitre


On 23/09/25 6:23 am, Alistair Popple wrote:
> 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.
>
> Fixes: 21aa65bf82a7 ("mm: remove callers of pfn_t functionality")
> Signed-off-by: Alistair Popple <apopple@nvidia.com>
>
> Cc: Haiyue Wang <haiyuewa@163.com>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Nicolas Pitre <nico@fluxnic.net>
> ---
>   
>   

Reviewed-by: Dev Jain <dev.jain@arm.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cramfs: Fix incorrect physical page address calculation
  2025-09-23  0:53 [PATCH] cramfs: Fix incorrect physical page address calculation Alistair Popple
  2025-09-23  6:56 ` Dev Jain
@ 2025-09-23  7:38 ` David Hildenbrand
  1 sibling, 0 replies; 3+ messages in thread
From: David Hildenbrand @ 2025-09-23  7:38 UTC (permalink / raw)
  To: Alistair Popple, linux-fsdevel, linux-mm, akpm; +Cc: Haiyue Wang, Nicolas Pitre

On 23.09.25 02:53, Alistair Popple wrote:
> 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.
> 
> Fixes: 21aa65bf82a7 ("mm: remove callers of pfn_t functionality")
> Signed-off-by: Alistair Popple <apopple@nvidia.com>
> 
> Cc: Haiyue Wang <haiyuewa@163.com>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Nicolas Pitre <nico@fluxnic.net>
> ---

Reviewed-by: David Hildenbrand <david@redhat.com>

Hopefully that's all now -- scanned the original patch and all 
phys_to_pfn_t now seem to have a matching PHYS_PFN.

-- 
Cheers

David / dhildenb



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-09-23  7:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-23  0:53 [PATCH] cramfs: Fix incorrect physical page address calculation Alistair Popple
2025-09-23  6:56 ` Dev Jain
2025-09-23  7:38 ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox