diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-02-11 09:22:04 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-11 09:22:04 +0100 |
commit | 95fd4845ed0ffcab305b4f30ce1c12dc34f1b56c (patch) | |
tree | aa2aac22a5b329b778a6771a87bbf1945ad49bbd /kernel/sys.c | |
parent | d278c48435625cb6b7edcf6a547620768b175709 (diff) | |
parent | 8e4921515c1a379539607eb443d51c30f4f7f338 (diff) | |
download | linux-95fd4845ed0ffcab305b4f30ce1c12dc34f1b56c.tar.gz linux-95fd4845ed0ffcab305b4f30ce1c12dc34f1b56c.tar.bz2 linux-95fd4845ed0ffcab305b4f30ce1c12dc34f1b56c.zip |
Merge commit 'v2.6.29-rc4' into perfcounters/core
Conflicts:
arch/x86/kernel/setup_percpu.c
arch/x86/mm/fault.c
drivers/acpi/processor_idle.c
kernel/irq/handle.c
Diffstat (limited to 'kernel/sys.c')
-rw-r--r-- | kernel/sys.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/kernel/sys.c b/kernel/sys.c index 87ca037dc03a..c5e7dec4966e 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -1526,22 +1526,14 @@ SYSCALL_DEFINE2(setrlimit, unsigned int, resource, struct rlimit __user *, rlim) return -EINVAL; if (copy_from_user(&new_rlim, rlim, sizeof(*rlim))) return -EFAULT; + if (new_rlim.rlim_cur > new_rlim.rlim_max) + return -EINVAL; old_rlim = current->signal->rlim + resource; if ((new_rlim.rlim_max > old_rlim->rlim_max) && !capable(CAP_SYS_RESOURCE)) return -EPERM; - - if (resource == RLIMIT_NOFILE) { - if (new_rlim.rlim_max == RLIM_INFINITY) - new_rlim.rlim_max = sysctl_nr_open; - if (new_rlim.rlim_cur == RLIM_INFINITY) - new_rlim.rlim_cur = sysctl_nr_open; - if (new_rlim.rlim_max > sysctl_nr_open) - return -EPERM; - } - - if (new_rlim.rlim_cur > new_rlim.rlim_max) - return -EINVAL; + if (resource == RLIMIT_NOFILE && new_rlim.rlim_max > sysctl_nr_open) + return -EPERM; retval = security_task_setrlimit(resource, &new_rlim); if (retval) |