Skip to content

Commit 91cb2c8

Browse files
committed
arm64: Do not pass tagged addresses to __is_lm_address()
Commit 519ea6f ("arm64: Fix kernel address detection of __is_lm_address()") fixed the incorrect validation of addresses below PAGE_OFFSET. However, it no longer allowed tagged addresses to be passed to virt_addr_valid(). Fix this by explicitly resetting the pointer tag prior to invoking __is_lm_address(). This is consistent with the __lm_to_phys() macro. Fixes: 519ea6f ("arm64: Fix kernel address detection of __is_lm_address()") Signed-off-by: Catalin Marinas <[email protected]> Acked-by: Ard Biesheuvel <[email protected]> Cc: <[email protected]> # 5.4.x Cc: Will Deacon <[email protected]> Cc: Vincenzo Frascino <[email protected]> Cc: Mark Rutland <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a1df829 commit 91cb2c8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

arch/arm64/include/asm/memory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ static inline void *phys_to_virt(phys_addr_t x)
332332
#endif /* !CONFIG_SPARSEMEM_VMEMMAP || CONFIG_DEBUG_VIRTUAL */
333333

334334
#define virt_addr_valid(addr) ({ \
335-
__typeof__(addr) __addr = addr; \
335+
__typeof__(addr) __addr = __tag_reset(addr); \
336336
__is_lm_address(__addr) && pfn_valid(virt_to_pfn(__addr)); \
337337
})
338338

arch/arm64/mm/physaddr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
phys_addr_t __virt_to_phys(unsigned long x)
1111
{
12-
WARN(!__is_lm_address(x),
12+
WARN(!__is_lm_address(__tag_reset(x)),
1313
"virt_to_phys used for non-linear address: %pK (%pS)\n",
1414
(void *)x,
1515
(void *)x);

0 commit comments

Comments
 (0)