diff options
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index bab7b254ad39..b0ec34abc0bb 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -828,6 +828,8 @@ void __cleanup_sighand(struct sighand_struct *sighand) | |||
828 | */ | 828 | */ |
829 | static void posix_cpu_timers_init_group(struct signal_struct *sig) | 829 | static void posix_cpu_timers_init_group(struct signal_struct *sig) |
830 | { | 830 | { |
831 | unsigned long cpu_limit; | ||
832 | |||
831 | /* Thread group counters. */ | 833 | /* Thread group counters. */ |
832 | thread_group_cputime_init(sig); | 834 | thread_group_cputime_init(sig); |
833 | 835 | ||
@@ -842,9 +844,9 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig) | |||
842 | sig->cputime_expires.virt_exp = cputime_zero; | 844 | sig->cputime_expires.virt_exp = cputime_zero; |
843 | sig->cputime_expires.sched_exp = 0; | 845 | sig->cputime_expires.sched_exp = 0; |
844 | 846 | ||
845 | if (sig->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY) { | 847 | cpu_limit = ACCESS_ONCE(sig->rlim[RLIMIT_CPU].rlim_cur); |
846 | sig->cputime_expires.prof_exp = | 848 | if (cpu_limit != RLIM_INFINITY) { |
847 | secs_to_cputime(sig->rlim[RLIMIT_CPU].rlim_cur); | 849 | sig->cputime_expires.prof_exp = secs_to_cputime(cpu_limit); |
848 | sig->cputimer.running = 1; | 850 | sig->cputimer.running = 1; |
849 | } | 851 | } |
850 | 852 | ||
@@ -1037,7 +1039,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1037 | #endif | 1039 | #endif |
1038 | retval = -EAGAIN; | 1040 | retval = -EAGAIN; |
1039 | if (atomic_read(&p->real_cred->user->processes) >= | 1041 | if (atomic_read(&p->real_cred->user->processes) >= |
1040 | p->signal->rlim[RLIMIT_NPROC].rlim_cur) { | 1042 | task_rlimit(p, RLIMIT_NPROC)) { |
1041 | if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) && | 1043 | if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) && |
1042 | p->real_cred->user != INIT_USER) | 1044 | p->real_cred->user != INIT_USER) |
1043 | goto bad_fork_free; | 1045 | goto bad_fork_free; |