diff options
| author | David S. Miller <davem@davemloft.net> | 2010-10-06 19:11:17 -0700 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2010-10-06 19:11:17 -0700 |
| commit | 12e94471b2be5ef9b55b10004a3a2cd819490036 (patch) | |
| tree | f84ae818687dc7c35bd54f11bfb9717278d28a4e /kernel/compat.c | |
| parent | 79315068f4560f3f7bd6e9790190dcb43059770c (diff) | |
| parent | cb655d0f3d57c23db51b981648e452988c0223f9 (diff) | |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'kernel/compat.c')
| -rw-r--r-- | kernel/compat.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/kernel/compat.c b/kernel/compat.c index e167efce842..c9e2ec0b34a 100644 --- a/kernel/compat.c +++ b/kernel/compat.c @@ -1126,3 +1126,24 @@ compat_sys_sysinfo(struct compat_sysinfo __user *info) return 0; } + +/* + * Allocate user-space memory for the duration of a single system call, + * in order to marshall parameters inside a compat thunk. + */ +void __user *compat_alloc_user_space(unsigned long len) +{ + void __user *ptr; + + /* If len would occupy more than half of the entire compat space... */ + if (unlikely(len > (((compat_uptr_t)~0) >> 1))) + return NULL; + + ptr = arch_compat_alloc_user_space(len); + + if (unlikely(!access_ok(VERIFY_WRITE, ptr, len))) + return NULL; + + return ptr; +} +EXPORT_SYMBOL_GPL(compat_alloc_user_space); |
