From: Bastian Blank Date: Sun, 10 Feb 2008 14:47:57 +0000 (+0200) Subject: splice: fix user pointer access in get_iovec_page_array() X-Git-Tag: v2.6.25-rc1~6 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=712a30e63c8066ed84385b12edbfb804f49cbc44;p=linux-2.6 splice: fix user pointer access in get_iovec_page_array() Commit 8811930dc74a503415b35c4a79d14fb0b408a361 ("splice: missing user pointer access verification") added the proper access_ok() calls to copy_from_user_mmap_sem() which ensures we can copy the struct iovecs from userspace to the kernel. But we also must check whether we can access the actual memory region pointed to by the struct iovec to fix the access checks properly. Signed-off-by: Bastian Blank Acked-by: Oliver Pinter Cc: Jens Axboe Cc: Andrew Morton Signed-off-by: Pekka Enberg Signed-off-by: Linus Torvalds --- diff --git a/fs/splice.c b/fs/splice.c index 14e2262c0a..9b559ee711 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -1234,7 +1234,7 @@ static int get_iovec_page_array(const struct iovec __user *iov, if (unlikely(!len)) break; error = -EFAULT; - if (unlikely(!base)) + if (!access_ok(VERIFY_READ, base, len)) break; /*