OSDN Git Service

Merge tag 'vfs-5.18-merge-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 2 Apr 2022 02:35:56 +0000 (19:35 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 2 Apr 2022 02:35:56 +0000 (19:35 -0700)
Pull vfs fix from Darrick Wong:
 "The erofs developers felt that FIEMAP should handle ranged requests
  starting at s_maxbytes by returning EFBIG instead of passing the
  filesystem implementation a nonsense 0-byte request.

  Not sure why they keep tagging this 'iomap', but the VFS shouldn't be
  asking for information about ranges of a file that the filesystem
  already declared that it does not support.

   - Fix a potential infinite loop in FIEMAP by fixing an off by one
     error when comparing the requested range against s_maxbytes"

* tag 'vfs-5.18-merge-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  fs: fix an infinite loop in iomap_fiemap

1  2 
fs/ioctl.c

diff --combined fs/ioctl.c
@@@ -173,7 -173,7 +173,7 @@@ int fiemap_prep(struct inode *inode, st
  
        if (*len == 0)
                return -EINVAL;
-       if (start > maxbytes)
+       if (start >= maxbytes)
                return -EFBIG;
  
        /*
@@@ -236,6 -236,9 +236,6 @@@ static long ioctl_file_clone(struct fil
  
        if (!src_file.file)
                return -EBADF;
 -      ret = -EXDEV;
 -      if (src_file.file->f_path.mnt != dst_file->f_path.mnt)
 -              goto fdput;
        cloned = vfs_clone_file_range(src_file.file, off, dst_file, destoff,
                                      olen, 0);
        if (cloned < 0)
                ret = -EINVAL;
        else
                ret = 0;
 -fdput:
        fdput(src_file);
        return ret;
  }