aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIra Weiny <[email protected]>2023-02-03 20:06:32 -0800
committerJens Wiklander <[email protected]>2023-02-13 14:16:35 +0100
commitf3837ab7adbc1799a3c5648d34e3e27eb70709a6 (patch)
tree2f97e5766bd0ccc0c2f0e25f4b26ed52f0aee2d9
parentceaa837f96adb69c0df0397937cd74991d5d821a (diff)
highmem: Enhance is_kmap_addr() to check kmap_local_page() mappings
is_kmap_addr() is only looking at the kmap() address range which may cause check_heap_object() to miss checking an overflow on a kmap_local_page() page. Add a check for the kmap_local_page() address range to is_kmap_addr(). Cc: Matthew Wilcox <[email protected]> Cc: Al Viro <[email protected]> Cc: "Fabio M. De Francesco" <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Andrew Morton <[email protected]> Signed-off-by: Ira Weiny <[email protected]> Acked-by: Andrew Morton <[email protected]> Signed-off-by: Jens Wiklander <[email protected]>
-rw-r--r--include/linux/highmem-internal.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/highmem-internal.h b/include/linux/highmem-internal.h
index e098f38422af..a3028e400a9c 100644
--- a/include/linux/highmem-internal.h
+++ b/include/linux/highmem-internal.h
@@ -152,7 +152,10 @@ static inline void totalhigh_pages_add(long count)
static inline bool is_kmap_addr(const void *x)
{
unsigned long addr = (unsigned long)x;
- return addr >= PKMAP_ADDR(0) && addr < PKMAP_ADDR(LAST_PKMAP);
+
+ return (addr >= PKMAP_ADDR(0) && addr < PKMAP_ADDR(LAST_PKMAP)) ||
+ (addr >= __fix_to_virt(FIX_KMAP_END) &&
+ addr < __fix_to_virt(FIX_KMAP_BEGIN));
}
#else /* CONFIG_HIGHMEM */