diff options
-rw-r--r-- | kernel/sys.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/sys.c b/kernel/sys.c index 9bdf94f3ae29..9e157e0240d4 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -1661,8 +1661,19 @@ asmlinkage long sys_setrlimit(unsigned int resource, struct rlimit __user *rlim) | |||
1661 | 1661 | ||
1662 | it_prof_secs = cputime_to_secs(current->signal->it_prof_expires); | 1662 | it_prof_secs = cputime_to_secs(current->signal->it_prof_expires); |
1663 | if (it_prof_secs == 0 || new_rlim.rlim_cur <= it_prof_secs) { | 1663 | if (it_prof_secs == 0 || new_rlim.rlim_cur <= it_prof_secs) { |
1664 | cputime_t cputime = secs_to_cputime(new_rlim.rlim_cur); | 1664 | unsigned long rlim_cur = new_rlim.rlim_cur; |
1665 | cputime_t cputime; | ||
1665 | 1666 | ||
1667 | if (rlim_cur == 0) { | ||
1668 | /* | ||
1669 | * The caller is asking for an immediate RLIMIT_CPU | ||
1670 | * expiry. But we use the zero value to mean "it was | ||
1671 | * never set". So let's cheat and make it one second | ||
1672 | * instead | ||
1673 | */ | ||
1674 | rlim_cur = 1; | ||
1675 | } | ||
1676 | cputime = secs_to_cputime(rlim_cur); | ||
1666 | read_lock(&tasklist_lock); | 1677 | read_lock(&tasklist_lock); |
1667 | spin_lock_irq(¤t->sighand->siglock); | 1678 | spin_lock_irq(¤t->sighand->siglock); |
1668 | set_process_cpu_timer(current, CPUCLOCK_PROF, &cputime, NULL); | 1679 | set_process_cpu_timer(current, CPUCLOCK_PROF, &cputime, NULL); |