diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-02-11 03:22:04 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-11 03:22:04 -0500 |
commit | 95fd4845ed0ffcab305b4f30ce1c12dc34f1b56c (patch) | |
tree | aa2aac22a5b329b778a6771a87bbf1945ad49bbd /kernel/sys.c | |
parent | d278c48435625cb6b7edcf6a547620768b175709 (diff) | |
parent | 8e4921515c1a379539607eb443d51c30f4f7f338 (diff) |
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) | |||
1526 | return -EINVAL; | 1526 | return -EINVAL; |
1527 | if (copy_from_user(&new_rlim, rlim, sizeof(*rlim))) | 1527 | if (copy_from_user(&new_rlim, rlim, sizeof(*rlim))) |
1528 | return -EFAULT; | 1528 | return -EFAULT; |
1529 | if (new_rlim.rlim_cur > new_rlim.rlim_max) | ||
1530 | return -EINVAL; | ||
1529 | old_rlim = current->signal->rlim + resource; | 1531 | old_rlim = current->signal->rlim + resource; |
1530 | if ((new_rlim.rlim_max > old_rlim->rlim_max) && | 1532 | if ((new_rlim.rlim_max > old_rlim->rlim_max) && |
1531 | !capable(CAP_SYS_RESOURCE)) | 1533 | !capable(CAP_SYS_RESOURCE)) |
1532 | return -EPERM; | 1534 | return -EPERM; |
1533 | 1535 | if (resource == RLIMIT_NOFILE && new_rlim.rlim_max > sysctl_nr_open) | |
1534 | if (resource == RLIMIT_NOFILE) { | 1536 | return -EPERM; |
1535 | if (new_rlim.rlim_max == RLIM_INFINITY) | ||
1536 | new_rlim.rlim_max = sysctl_nr_open; | ||
1537 | if (new_rlim.rlim_cur == RLIM_INFINITY) | ||
1538 | new_rlim.rlim_cur = sysctl_nr_open; | ||
1539 | if (new_rlim.rlim_max > sysctl_nr_open) | ||
1540 | return -EPERM; | ||
1541 | } | ||
1542 | |||
1543 | if (new_rlim.rlim_cur > new_rlim.rlim_max) | ||
1544 | return -EINVAL; | ||
1545 | 1537 | ||
1546 | retval = security_task_setrlimit(resource, &new_rlim); | 1538 | retval = security_task_setrlimit(resource, &new_rlim); |
1547 | if (retval) | 1539 | if (retval) |