page_poison: play nicely with KASAN
[linux-block.git] / mm / page_poison.c
index f0c15e9017c02236e56cb71948d992c584226d0c..21d4f97cb49ba4486e2c00c51e052e13370671e4 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/page_ext.h>
 #include <linux/poison.h>
 #include <linux/ratelimit.h>
+#include <linux/kasan.h>
 
 static bool want_page_poisoning __read_mostly;
 
@@ -40,7 +41,10 @@ static void poison_page(struct page *page)
 {
        void *addr = kmap_atomic(page);
 
+       /* KASAN still think the page is in-use, so skip it. */
+       kasan_disable_current();
        memset(addr, PAGE_POISON, PAGE_SIZE);
+       kasan_enable_current();
        kunmap_atomic(addr);
 }