[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen stable-4.22] xen/arm: Fix under-mapping in map_range_to_domain()



commit 5c698f1d67421be57695c5c0984ebfc19f8cd20d
Author:     Michal Orzel <michal.orzel@xxxxxxx>
AuthorDate: Wed Oct 7 15:58:48 2026 +0200
Commit:     Michal Orzel <michal.orzel@xxxxxxx>
CommitDate: Thu Nov 12 11:48:13 2026 +0100

    xen/arm: Fix under-mapping in map_range_to_domain()
    
    If the memory region to be mapped does not start at the page boundary
    and its end spans over the page boundary, map_range_to_domain() passes
    a number of pages that is short by one to map_regions_p2mt(). Domain's
    attempt to access memory within that page will fail. Fix it by calculating
    the number of pages to be mapped taking into account the start offset.
    
    Fixes: 88c10b0d6eee ("arch/arm: let map_mmio_regions() use start and count")
    Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
    Acked-by: Julien Grall <julien@xxxxxxx>
    (cherry picked from commit 9a6cc49b44b458c2ce4cac36ea6c411d06850ac5)
---
 xen/arch/arm/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c
index 7d9644fd8b..f6f89d3a4b 100644
--- a/xen/arch/arm/device.c
+++ b/xen/arch/arm/device.c
@@ -88,7 +88,7 @@ int __overlay_init map_range_to_domain(const struct 
dt_device_node *dev,
     {
         res = map_regions_p2mt(d,
                                gaddr_to_gfn(addr),
-                               PFN_UP(len),
+                               PFN_UP(addr + len) - PFN_DOWN(addr),
                                maddr_to_mfn(addr),
                                mr_data->p2mt);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.22



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.