]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
prctl: use access_ok() instead of TASK_SIZE in prctl_set_mm()
authorCyrill Gorcunov <gorcunov@openvz.org>
Wed, 26 Sep 2012 01:33:02 +0000 (11:33 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 27 Sep 2012 07:25:17 +0000 (17:25 +1000)
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>
kernel/sys.c

index f9492284e5d23b76862dd87dcf458fc80a7072bb..3a2dc1efc270fbea4aa0056f3f6157a26ccfcb44 100644 (file)
@@ -1865,7 +1865,7 @@ static int prctl_set_mm(int opt, unsigned long addr,
        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;