mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 3/4] posix timers: timer_delete: remove the bogus "->it_process != NULL" check
@ 2008-05-03 17:35 Oleg Nesterov
  2008-05-06  2:33 ` Roland McGrath
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2008-05-03 17:35 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Austin Clements, Ingo Molnar, john stultz, Linus Torvalds,
	Michael Kerrisk, Roland McGrath, Thomas Gleixner, linux-kernel

sys_timer_delete() and itimer_delete() check "timer->it_process != NULL", this
looks completely bogus. ->it_process == NULL means that this timer is already
under destruction or it is not fully initialized, this must not happen.

	sys_timer_delete: the timer is locked, and lock_timer() can't succeed
	if ->it_process == NULL.

	itimer_delete: it is called by exit_itimers() when there are no other
	threads which can play with signal_struct->posix_timers.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- 25/kernel/posix-timers.c~3_TDEL_NO_CHECK	2008-04-24 16:52:11.000000000 +0400
+++ 25/kernel/posix-timers.c	2008-05-03 19:55:27.000000000 +0400
@@ -855,11 +855,10 @@ retry_delete:
 	 * This keeps any tasks waiting on the spin lock from thinking
 	 * they got something (see the lock code above).
 	 */
-	if (timer->it_process) {
-		if (timer->it_sigev_notify == (SIGEV_SIGNAL|SIGEV_THREAD_ID))
-			put_task_struct(timer->it_process);
-		timer->it_process = NULL;
-	}
+	if (timer->it_sigev_notify == (SIGEV_SIGNAL|SIGEV_THREAD_ID))
+		put_task_struct(timer->it_process);
+	timer->it_process = NULL;
+
 	unlock_timer(timer, flags);
 	release_posix_timer(timer, IT_ID_SET);
 	return 0;
@@ -884,11 +883,10 @@ retry_delete:
 	 * This keeps any tasks waiting on the spin lock from thinking
 	 * they got something (see the lock code above).
 	 */
-	if (timer->it_process) {
-		if (timer->it_sigev_notify == (SIGEV_SIGNAL|SIGEV_THREAD_ID))
-			put_task_struct(timer->it_process);
-		timer->it_process = NULL;
-	}
+	if (timer->it_sigev_notify == (SIGEV_SIGNAL|SIGEV_THREAD_ID))
+		put_task_struct(timer->it_process);
+	timer->it_process = NULL;
+
 	unlock_timer(timer, flags);
 	release_posix_timer(timer, IT_ID_SET);
 }


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 3/4] posix timers: timer_delete: remove the bogus "->it_process != NULL" check
  2008-05-03 17:35 [PATCH 3/4] posix timers: timer_delete: remove the bogus "->it_process != NULL" check Oleg Nesterov
@ 2008-05-06  2:33 ` Roland McGrath
  0 siblings, 0 replies; 2+ messages in thread
From: Roland McGrath @ 2008-05-06  2:33 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, Austin Clements, Ingo Molnar, john stultz,
	Linus Torvalds, Michael Kerrisk, Thomas Gleixner, linux-kernel

Signed-off-by: Roland McGrath <roland@redhat.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-05-06  2:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-03 17:35 [PATCH 3/4] posix timers: timer_delete: remove the bogus "->it_process != NULL" check Oleg Nesterov
2008-05-06  2:33 ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®