|
|
@@ -15,6 +15,7 @@
|
|
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
|
|
|
|
|
#include <linux/mm.h>
|
|
|
+#include <linux/highmem.h>
|
|
|
#include <linux/slab.h>
|
|
|
#include <linux/sched.h>
|
|
|
#include <linux/sched/task.h>
|
|
|
@@ -231,7 +232,12 @@ static inline void check_heap_object(const void *ptr, unsigned long n,
|
|
|
if (!virt_addr_valid(ptr))
|
|
|
return;
|
|
|
|
|
|
- page = virt_to_head_page(ptr);
|
|
|
+ /*
|
|
|
+ * When CONFIG_HIGHMEM=y, kmap_to_page() will give either the
|
|
|
+ * highmem page or fallback to virt_to_page(). The following
|
|
|
+ * is effectively a highmem-aware virt_to_head_page().
|
|
|
+ */
|
|
|
+ page = compound_head(kmap_to_page((void *)ptr));
|
|
|
|
|
|
if (PageSlab(page)) {
|
|
|
/* Check slab allocator for flags and size. */
|