arm64: dts: clearfog-gt-8k: describe mini-PCIe CON2 USB
[linux-2.6-block.git] / fs / ioctl.c
index 2005529af560891043170b4d86ed05c2a62f19eb..d64f622cac8b8f7a9cb0fdd842ce0f788f857c8d 100644 (file)
@@ -223,6 +223,7 @@ static long ioctl_file_clone(struct file *dst_file, unsigned long srcfd,
                             u64 off, u64 olen, u64 destoff)
 {
        struct fd src_file = fdget(srcfd);
+       loff_t cloned;
        int ret;
 
        if (!src_file.file)
@@ -230,7 +231,14 @@ static long ioctl_file_clone(struct file *dst_file, unsigned long srcfd,
        ret = -EXDEV;
        if (src_file.file->f_path.mnt != dst_file->f_path.mnt)
                goto fdput;
-       ret = vfs_clone_file_range(src_file.file, off, dst_file, destoff, olen);
+       cloned = vfs_clone_file_range(src_file.file, off, dst_file, destoff,
+                                     olen, 0);
+       if (cloned < 0)
+               ret = cloned;
+       else if (olen && cloned != olen)
+               ret = -EINVAL;
+       else
+               ret = 0;
 fdput:
        fdput(src_file);
        return ret;
@@ -669,6 +677,9 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
                return ioctl_fiemap(filp, arg);
 
        case FIGETBSZ:
+               /* anon_bdev filesystems may not have a block size */
+               if (!inode->i_sb->s_blocksize)
+                       return -EINVAL;
                return put_user(inode->i_sb->s_blocksize, argp);
 
        case FICLONE: