]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - mm/hwpoison-inject.c
net: heap overflow in __audit_sockaddr()
[karo-tx-linux.git] / mm / hwpoison-inject.c
index 3a61efc518d56964460af63ca31ba26bc375ad47..4c84678371eb5b5905cc8c4386b512ec57e4f5e3 100644 (file)
@@ -20,8 +20,6 @@ static int hwpoison_inject(void *data, u64 val)
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
-       if (!hwpoison_filter_enable)
-               goto inject;
        if (!pfn_valid(pfn))
                return -ENXIO;
 
@@ -33,6 +31,9 @@ static int hwpoison_inject(void *data, u64 val)
        if (!get_page_unless_zero(hpage))
                return 0;
 
+       if (!hwpoison_filter_enable)
+               goto inject;
+
        if (!PageLRU(p) && !PageHuge(p))
                shake_page(p, 0);
        /*
@@ -88,12 +89,12 @@ static int pfn_inject_init(void)
         * hardware status change, hence do not require hardware support.
         * They are mainly for testing hwpoison in software level.
         */
-       dentry = debugfs_create_file("corrupt-pfn", 0600, hwpoison_dir,
+       dentry = debugfs_create_file("corrupt-pfn", 0200, hwpoison_dir,
                                          NULL, &hwpoison_fops);
        if (!dentry)
                goto fail;
 
-       dentry = debugfs_create_file("unpoison-pfn", 0600, hwpoison_dir,
+       dentry = debugfs_create_file("unpoison-pfn", 0200, hwpoison_dir,
                                     NULL, &unpoison_fops);
        if (!dentry)
                goto fail;