]> Git Repo - linux.git/commitdiff
arm64: Do not pass tagged addresses to __is_lm_address()
authorCatalin Marinas <[email protected]>
Mon, 1 Feb 2021 19:06:33 +0000 (19:06 +0000)
committerCatalin Marinas <[email protected]>
Tue, 2 Feb 2021 17:44:47 +0000 (17:44 +0000)
Commit 519ea6f1c82f ("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: 519ea6f1c82f ("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]
arch/arm64/include/asm/memory.h
arch/arm64/mm/physaddr.c

index 99d7e1494aaa62aceab0032d8dcb68734fafecd7..3c1aaa522cbdd4515fd3d37d42d721a52dbd037f 100644 (file)
@@ -332,7 +332,7 @@ static inline void *phys_to_virt(phys_addr_t x)
 #endif /* !CONFIG_SPARSEMEM_VMEMMAP || CONFIG_DEBUG_VIRTUAL */
 
 #define virt_addr_valid(addr)  ({                                      \
-       __typeof__(addr) __addr = addr;                                 \
+       __typeof__(addr) __addr = __tag_reset(addr);                    \
        __is_lm_address(__addr) && pfn_valid(virt_to_pfn(__addr));      \
 })
 
index 67a9ba9eaa96bd1b900732e6c134010a5bf9c3a6..cde44c13dda1bc0924d2d50369ad87f544a0a802 100644 (file)
@@ -9,7 +9,7 @@
 
 phys_addr_t __virt_to_phys(unsigned long x)
 {
-       WARN(!__is_lm_address(x),
+       WARN(!__is_lm_address(__tag_reset(x)),
             "virt_to_phys used for non-linear address: %pK (%pS)\n",
              (void *)x,
              (void *)x);
This page took 0.063303 seconds and 4 git commands to generate.