Eric pointed that better to use access_ok instead of TASK_SIZE for testing
if address is allowed for use.
Reported-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Mark Salter <msalter@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
if (opt == PR_SET_MM_EXE_FILE)
return prctl_set_mm_exe_file(mm, (unsigned int)addr);
- if (addr >= TASK_SIZE || addr < mmap_min_addr)
+ if (!access_ok(VERIFY_READ, addr, sizeof(addr)) || addr < mmap_min_addr)
return -EINVAL;
error = -EINVAL;