Merge tag 'pci-v5.11-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaa...
[linux-2.6-microblaze.git] / fs / remap_range.c
index e6099be..77dba3a 100644 (file)
@@ -456,8 +456,16 @@ loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos,
        if (ret)
                return ret;
 
+       /*
+        * This is redundant if called from vfs_dedupe_file_range(), but other
+        * callers need it and it's not performance sesitive...
+        */
+       ret = remap_verify_area(src_file, src_pos, len, false);
+       if (ret)
+               goto out_drop_write;
+
        ret = remap_verify_area(dst_file, dst_pos, len, true);
-       if (ret < 0)
+       if (ret)
                goto out_drop_write;
 
        ret = -EPERM;