Commit 8aeb5c44 authored by Vincenzo Frascino's avatar Vincenzo Frascino
Browse files

kasan: Make addr_has_metadata() return true for valid addresses

Currently, addr_has_metadata() returns true for every address.
An invalid address (e.g. NULL) passed to the function when,
KASAN_HW_TAGS is enabled, leads to a kernel panic.

Make addr_has_metadata() return true for valid addresses only.

Note: KASAN_HW_TAGS support for vmalloc will be added with a future

Cc: Andrey Ryabinin <>
Cc: Alexander Potapenko <>
Cc: Dmitry Vyukov <>
Cc: Leon Romanovsky <>
Cc: Andrey Konovalov <>
Reviewed-by: default avatarAndrey Konovalov <>
Signed-off-by: Vincenzo Frascino's avatarVincenzo Frascino <>
parent 0e1a7ff2
......@@ -209,7 +209,7 @@ bool check_memory_region(unsigned long addr, size_t size, bool write,
static inline bool addr_has_metadata(const void *addr)
return true;
return (is_vmalloc_addr(addr) || virt_addr_valid(addr));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment