kasan: inline (un)poison_range and check_invalid_free
[linux-2.6-microblaze.git] / mm / hwpoison-inject.c
index e488876..1ae1ebc 100644 (file)
@@ -26,11 +26,6 @@ static int hwpoison_inject(void *data, u64 val)
 
        p = pfn_to_page(pfn);
        hpage = compound_head(p);
-       /*
-        * This implies unable to support free buddy pages.
-        */
-       if (!get_hwpoison_page(p))
-               return 0;
 
        if (!hwpoison_filter_enable)
                goto inject;
@@ -40,23 +35,20 @@ static int hwpoison_inject(void *data, u64 val)
         * This implies unable to support non-LRU pages.
         */
        if (!PageLRU(hpage) && !PageHuge(p))
-               goto put_out;
+               return 0;
 
        /*
-        * do a racy check with elevated page count, to make sure PG_hwpoison
-        * will only be set for the targeted owner (or on a free page).
+        * do a racy check to make sure PG_hwpoison will only be set for
+        * the targeted owner (or on a free page).
         * memory_failure() will redo the check reliably inside page lock.
         */
        err = hwpoison_filter(hpage);
        if (err)
-               goto put_out;
+               return 0;
 
 inject:
        pr_info("Injecting memory failure at pfn %#lx\n", pfn);
-       return memory_failure(pfn, MF_COUNT_INCREASED);
-put_out:
-       put_hwpoison_page(p);
-       return 0;
+       return memory_failure(pfn, 0);
 }
 
 static int hwpoison_unpoison(void *data, u64 val)