Merge tag 'linux-watchdog-5.10-rc1' of git://www.linux-watchdog.org/linux-watchdog
[linux-2.6-microblaze.git] / lib / iov_iter.c
index 14cae25..1635111 100644 (file)
@@ -2,6 +2,7 @@
 #include <crypto/hash.h>
 #include <linux/export.h>
 #include <linux/bvec.h>
+#include <linux/fault-inject-usercopy.h>
 #include <linux/uio.h>
 #include <linux/pagemap.h>
 #include <linux/slab.h>
 
 static int copyout(void __user *to, const void *from, size_t n)
 {
+       if (should_fail_usercopy())
+               return n;
        if (access_ok(to, n)) {
                instrument_copy_to_user(to, from, n);
                n = raw_copy_to_user(to, from, n);
@@ -149,6 +152,8 @@ static int copyout(void __user *to, const void *from, size_t n)
 
 static int copyin(void *to, const void __user *from, size_t n)
 {
+       if (should_fail_usercopy())
+               return n;
        if (access_ok(from, n)) {
                instrument_copy_from_user(to, from, n);
                n = raw_copy_from_user(to, from, n);