From 2f277243d9a95f1808f0c0e979d632b29f366819 Mon Sep 17 00:00:00 2001 From: Bastian Blank Date: Sun, 10 Feb 2008 16:47:57 +0200 Subject: [PATCH] splice: fix user pointer access in get_iovec_page_array() Commit bb34c2b2405f9e03aa897a3998001a094278088e ("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 --- fs/splice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/splice.c b/fs/splice.c index 14e2262c0a046..9b559ee711a8e 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; /* -- 2.39.5