H. Peter Anvin c41d68a513 compat: Make compat_alloc_user_space() incorporate the access_ok()
compat_alloc_user_space() expects the caller to independently call
access_ok() to verify the returned area.  A missing call could
introduce problems on some architectures.

This patch incorporates the access_ok() check into
compat_alloc_user_space() and also adds a sanity check on the length.
The existing compat_alloc_user_space() implementations are renamed
arch_compat_alloc_user_space() and are used as part of the
implementation of the new global function.

This patch assumes NULL will cause __get_user()/__put_user() to either
fail or access userspace on all architectures.  This should be
followed by checking the return value of compat_access_user_space()
for NULL in the callers, at which time the access_ok() in the callers
can also be removed.

Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Chris Metcalf <cmetcalf@tilera.com>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Tony Luck <tony.luck@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: James Bottomley <jejb@parisc-linux.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: <stable@kernel.org>
2010-09-14 16:08:45 -07:00
..
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2008-12-09 00:50:13 -08:00
2008-08-31 20:59:37 -07:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2010-07-24 09:57:52 -06:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2009-12-16 07:20:12 -08:00
2010-01-29 08:22:01 -08:00
2008-07-27 23:00:59 +02:00
2009-06-07 05:01:00 -07:00
2009-12-17 11:03:24 -05:00
2008-08-31 20:56:15 -07:00
2008-07-30 15:40:50 -07:00
2008-07-27 23:00:59 +02:00
2008-08-24 20:33:56 -07:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2008-08-29 02:15:23 -07:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2010-08-10 13:47:39 -07:00
2008-07-27 23:00:59 +02:00
2009-01-04 15:44:52 -08:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2010-06-09 11:12:36 +02:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2010-07-14 17:14:00 +10:00
2008-07-27 23:00:59 +02:00
2008-12-26 15:35:41 -08:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2009-01-02 21:15:25 -08:00
2008-07-27 23:00:59 +02:00
2010-01-14 03:14:53 -08:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2009-01-02 18:35:29 -08:00
2008-07-27 23:00:59 +02:00
2009-01-02 19:42:12 -08:00
2008-07-27 23:00:59 +02:00
2010-08-17 22:49:26 -07:00
2008-07-27 23:00:59 +02:00
2008-12-27 00:35:12 -08:00
2008-07-27 23:00:59 +02:00
2009-01-02 19:34:46 -08:00
2009-01-02 21:10:04 -08:00
2009-11-02 04:19:42 -08:00
2008-07-27 23:00:59 +02:00
2008-12-07 00:04:30 -08:00
2008-09-06 19:30:17 +01:00
2009-01-06 18:10:27 -08:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2008-09-19 21:18:03 -07:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2009-01-02 21:33:05 -08:00
2009-08-16 18:25:00 -07:00
2010-08-09 00:45:46 -07:00
2010-08-09 00:45:46 -07:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00
2008-08-31 20:59:37 -07:00
2008-07-27 23:00:59 +02:00
2008-07-27 23:00:59 +02:00