]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
splice: fix user pointer access in get_iovec_page_array() (CVE-2008-0600)
authorBastian Blank <bastian@waldi.eu.org>
Sun, 10 Feb 2008 14:47:57 +0000 (16:47 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 11 Feb 2008 07:28:08 +0000 (23:28 -0800)
patch 712a30e63c8066ed84385b12edbfb804f49cbc44 in mainline.

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 <waldi@debian.org>
Acked-by: Oliver Pinter <oliver.pntr@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/splice.c

index e263d3b361456cf669a0782e84e8b3c61772f936..dbbe267211b19751423f8a212d8ff51165f2ecc5 100644 (file)
@@ -1182,6 +1182,9 @@ static int get_iovec_page_array(const struct iovec __user *iov,
                if (unlikely(!base))
                        break;
 
+               if (!access_ok(VERIFY_READ, base, len))
+                       break;
+
                /*
                 * Get this base offset and number of pages, then map
                 * in the user pages.