Skip to content

Commit 4e4f9e6

Browse files
cminyardtorvalds
authored andcommitted
fs/read_write.c:compat_readv(): remove bogus area verify
The compat_do_readv_writev() function was doing a verify_area on the incoming iov, but the nr_segs value is not checked. If someone passes in a -1 for nr_segs, for instance, the function should return an EINVAL. However, it returns a EFAULT because the verify_area fails because it is checking an array of size MAX_UINT. The check is bogus, anyway, because the next check, compat_rw_copy_check_uvector(), will do all the necessary checking, anyway. The non-compat do_readv_writev() function doesn't do this check, so I think it's safe to just remove the code. Signed-off-by: Corey Minyard <cminyard@mvista.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 38316c8 commit 4e4f9e6

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

‎fs/read_write.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -901,10 +901,6 @@ static ssize_t compat_do_readv_writev(int type, struct file *file,
901901
io_fn_t fn;
902902
iov_fn_t fnv;
903903

904-
ret = -EFAULT;
905-
if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector)))
906-
goto out;
907-
908904
ret = compat_rw_copy_check_uvector(type, uvector, nr_segs,
909905
UIO_FASTIOV, iovstack, &iov);
910906
if (ret <= 0)

0 commit comments

Comments
 (0)