diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/exit.c | 8 | ||||
| -rw-r--r-- | kernel/posix-cpu-timers.c | 36 |
2 files changed, 26 insertions, 18 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 4897977a1f4b..3b25b182d2be 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
| @@ -825,6 +825,14 @@ fastcall NORET_TYPE void do_exit(long code) | |||
| 825 | 825 | ||
| 826 | tsk->flags |= PF_EXITING; | 826 | tsk->flags |= PF_EXITING; |
| 827 | 827 | ||
| 828 | /* | ||
| 829 | * Make sure we don't try to process any timer firings | ||
| 830 | * while we are already exiting. | ||
| 831 | */ | ||
| 832 | tsk->it_virt_expires = cputime_zero; | ||
| 833 | tsk->it_prof_expires = cputime_zero; | ||
| 834 | tsk->it_sched_expires = 0; | ||
| 835 | |||
| 828 | if (unlikely(in_atomic())) | 836 | if (unlikely(in_atomic())) |
| 829 | printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n", | 837 | printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n", |
| 830 | current->comm, current->pid, | 838 | current->comm, current->pid, |
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index 383ba22f0b62..ea1aca5e7c2b 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c | |||
| @@ -1293,30 +1293,30 @@ void run_posix_cpu_timers(struct task_struct *tsk) | |||
| 1293 | 1293 | ||
| 1294 | #undef UNEXPIRED | 1294 | #undef UNEXPIRED |
| 1295 | 1295 | ||
| 1296 | BUG_ON(tsk->exit_state); | ||
| 1297 | |||
| 1296 | /* | 1298 | /* |
| 1297 | * Double-check with locks held. | 1299 | * Double-check with locks held. |
| 1298 | */ | 1300 | */ |
| 1299 | read_lock(&tasklist_lock); | 1301 | read_lock(&tasklist_lock); |
| 1300 | if (likely(tsk->signal != NULL)) { | 1302 | spin_lock(&tsk->sighand->siglock); |
| 1301 | spin_lock(&tsk->sighand->siglock); | ||
| 1302 | 1303 | ||
| 1303 | /* | 1304 | /* |
| 1304 | * Here we take off tsk->cpu_timers[N] and tsk->signal->cpu_timers[N] | 1305 | * Here we take off tsk->cpu_timers[N] and tsk->signal->cpu_timers[N] |
| 1305 | * all the timers that are firing, and put them on the firing list. | 1306 | * all the timers that are firing, and put them on the firing list. |
| 1306 | */ | 1307 | */ |
| 1307 | check_thread_timers(tsk, &firing); | 1308 | check_thread_timers(tsk, &firing); |
| 1308 | check_process_timers(tsk, &firing); | 1309 | check_process_timers(tsk, &firing); |
| 1309 | 1310 | ||
| 1310 | /* | 1311 | /* |
| 1311 | * We must release these locks before taking any timer's lock. | 1312 | * We must release these locks before taking any timer's lock. |
| 1312 | * There is a potential race with timer deletion here, as the | 1313 | * There is a potential race with timer deletion here, as the |
| 1313 | * siglock now protects our private firing list. We have set | 1314 | * siglock now protects our private firing list. We have set |
| 1314 | * the firing flag in each timer, so that a deletion attempt | 1315 | * the firing flag in each timer, so that a deletion attempt |
| 1315 | * that gets the timer lock before we do will give it up and | 1316 | * that gets the timer lock before we do will give it up and |
| 1316 | * spin until we've taken care of that timer below. | 1317 | * spin until we've taken care of that timer below. |
| 1317 | */ | 1318 | */ |
| 1318 | spin_unlock(&tsk->sighand->siglock); | 1319 | spin_unlock(&tsk->sighand->siglock); |
| 1319 | } | ||
| 1320 | read_unlock(&tasklist_lock); | 1320 | read_unlock(&tasklist_lock); |
| 1321 | 1321 | ||
| 1322 | /* | 1322 | /* |
