Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 918fc037 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Thomas Gleixner
Browse files

posix-timers: always do get_task_struct(timer->it_process)



Change the code to get/put timer->it_process regardless of
SIGEV_THREAD_ID.  This streamlines the create/destroy paths and allows us
to simplify the usage of exit_itimers() in de_thread().

Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
Cc: mingo@elte.hu
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 4aa73611
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -540,11 +540,10 @@ sys_timer_create(const clockid_t which_clock,
			 */
			spin_lock_irqsave(&process->sighand->siglock, flags);
			if (!(process->flags & PF_EXITING)) {
				get_task_struct(process);
				new_timer->it_process = process;
				list_add(&new_timer->list,
					 &process->signal->posix_timers);
				if (new_timer->it_sigev_notify == (SIGEV_SIGNAL|SIGEV_THREAD_ID))
					get_task_struct(process);
				spin_unlock_irqrestore(&process->sighand->siglock, flags);
			} else {
				spin_unlock_irqrestore(&process->sighand->siglock, flags);
@@ -561,6 +560,7 @@ sys_timer_create(const clockid_t which_clock,
		new_timer->it_sigev_signo = SIGALRM;
		new_timer->it_sigev_value.sival_int = new_timer->it_id;
		process = current->group_leader;
		get_task_struct(process);
		spin_lock_irqsave(&process->sighand->siglock, flags);
		new_timer->it_process = process;
		list_add(&new_timer->list, &process->signal->posix_timers);
@@ -853,7 +853,6 @@ sys_timer_delete(timer_t timer_id)
	 * This keeps any tasks waiting on the spin lock from thinking
	 * they got something (see the lock code above).
	 */
	if (timer->it_sigev_notify == (SIGEV_SIGNAL|SIGEV_THREAD_ID))
	put_task_struct(timer->it_process);
	timer->it_process = NULL;

@@ -881,7 +880,6 @@ static void itimer_delete(struct k_itimer *timer)
	 * This keeps any tasks waiting on the spin lock from thinking
	 * they got something (see the lock code above).
	 */
	if (timer->it_sigev_notify == (SIGEV_SIGNAL|SIGEV_THREAD_ID))
	put_task_struct(timer->it_process);
	timer->it_process = NULL;