mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] compat_readv: Remove bogus area verify
@ 2013-12-28  1:23 Corey Minyard
  0 siblings, 0 replies; only message in thread
From: Corey Minyard @ 2013-12-28  1:23 UTC (permalink / raw)
  To: Linux Kernel; +Cc: Corey Minyard

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>
---
 fs/read_write.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/fs/read_write.c b/fs/read_write.c
index 58e440d..1193ffd 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -901,10 +901,6 @@ static ssize_t compat_do_readv_writev(int type, struct file *file,
 	io_fn_t fn;
 	iov_fn_t fnv;
 
-	ret = -EFAULT;
-	if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector)))
-		goto out;
-
 	ret = compat_rw_copy_check_uvector(type, uvector, nr_segs,
 					       UIO_FASTIOV, iovstack, &iov);
 	if (ret <= 0)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-12-28  1:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-28  1:23 [PATCH] compat_readv: Remove bogus area verify Corey Minyard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®