arm:mmap: fix physical address overflow when CONFIG_ARM_LPAE=y
Subsystems (2)
PATCH 1/1 arm:mmap: fix physical address overflow when CONFIG_ARM_LPAE=y
When the CONFIG_ARM_LPAE is enabled on arm32, the physical address may exceed 32 bits. In the devmem_is_allowed function, the physical address is obtained through displacement of the physical page number.Without explicit translation, the physical address may overflow and be truncated. Use the PFN_PHYS macro to fix this bug.
This bug was initially introduced in v2.6.37 with commit:087aaffcdf9c91. In v5.10, this code has been modified by commit:527701eda5f196.
--- lib/devmem_is_allowed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/devmem_is_allowed.c +1 -1
@@ -19,7 +19,7 @@*/ int devmem_is_allowed (unsigned long pfn) { -if (iomem_is_exclusive (pfn <<PAGE_SHIFT )) +if (iomem_is_exclusive (PFN_PHYS (pfn)))return 0 ;if (!page_is_ram (pfn))return 1 ;
Signature · 1 line
2.32.0
add arm list
-----邮件原件-----
发件人: wangliang (C)
发送时间: 2021年7月15日 20:30
收件人: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
抄送: [email protected]; wangliang (C) <[email protected]>; Wangle (RTOS FAE) <[email protected]>; Chenxin (RTOS) <[email protected]>; Nixiaoming <[email protected]> 主题: [PATCH] arm:mmap: fix physical address overflow when CONFIG_ARM_LPAE=y
When the CONFIG_ARM_LPAE is enabled on arm32, the physical address may exceed 32 bits. In the devmem_is_allowed function, the physical address is obtained through displacement of the physical page number.Without explicit translation, the physical address may overflow and be truncated. Use the PFN_PHYS macro to fix this bug.
This bug was initially introduced in v2.6.37 with commit:087aaffcdf9c91. In v5.10, this code has been modified by commit:527701eda5f196.
--- lib/devmem_is_allowed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/devmem_is_allowed.c +1 -2
@@ -19,7 +19,7 @@*/ int devmem_is_allowed (unsigned long pfn) { -if (iomem_is_exclusive (pfn <<PAGE_SHIFT )) +if (iomem_is_exclusive (PFN_PHYS (pfn)))return 0 ;if (!page_is_ram (pfn))return 1 ; --
2.32.0