fuse: launder page should wait for page writeback
[linux-2.6-microblaze.git] / lib / strncpy_from_user.c
index 34696a3..e6d5fcc 100644 (file)
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/compiler.h>
 #include <linux/export.h>
+#include <linux/fault-inject-usercopy.h>
 #include <linux/kasan-checks.h>
 #include <linux/thread_info.h>
 #include <linux/uaccess.h>
@@ -99,6 +100,8 @@ long strncpy_from_user(char *dst, const char __user *src, long count)
        unsigned long max_addr, src_addr;
 
        might_fault();
+       if (should_fail_usercopy())
+               return -EFAULT;
        if (unlikely(count <= 0))
                return 0;