ext4: remove the access_ok() check in ext4_ioctl_get_es_cache
authorChristoph Hellwig <hch@lst.de>
Sat, 23 May 2020 07:30:16 +0000 (09:30 +0200)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 4 Jun 2020 03:16:55 +0000 (23:16 -0400)
access_ok just checks we are fed a proper user pointer.  We also do that
in copy_to_user itself, so no need to do this early.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20200523073016.2944131-10-hch@lst.de
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/ioctl.c

index f81acbbb1b12e0eb8657b75ca7d4912c98a7b1f8..2162db0c747d2694c7f050ef8447535ae17bab54 100644 (file)
@@ -754,11 +754,6 @@ static int ext4_ioctl_get_es_cache(struct file *filp, unsigned long arg)
        fieinfo.fi_extents_max = fiemap.fm_extent_count;
        fieinfo.fi_extents_start = ufiemap->fm_extents;
 
-       if (fiemap.fm_extent_count != 0 &&
-           !access_ok(fieinfo.fi_extents_start,
-                      fieinfo.fi_extents_max * sizeof(struct fiemap_extent)))
-               return -EFAULT;
-
        error = ext4_get_es_cache(inode, &fieinfo, fiemap.fm_start,
                        fiemap.fm_length);
        fiemap.fm_flags = fieinfo.fi_flags;