Commit e650bfc3 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] mprotect return value fix

From: Marc-Christian Petersen <m.c.p@wolk-project.de>

2.4 patch from Adrian Bunk.

ERRORS

    The mprotect() function shall fail if:

    ...

    [ENOMEM]
        Addresses in the range [addr,addr+len) are invalid for the
        address space of a process, or specify one or more pages which are
        not mapped.
parent 7d63de7a
...@@ -237,7 +237,7 @@ sys_mprotect(unsigned long start, size_t len, unsigned long prot) ...@@ -237,7 +237,7 @@ sys_mprotect(unsigned long start, size_t len, unsigned long prot)
len = PAGE_ALIGN(len); len = PAGE_ALIGN(len);
end = start + len; end = start + len;
if (end < start) if (end < start)
return -EINVAL; return -ENOMEM;
if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM)) if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM))
return -EINVAL; return -EINVAL;
if (end == start) if (end == start)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment