login
Header Space

 
 

[PATCH 4/4] posix timers: release_posix_timer: kill the bogus put_task_struct(->it_process);

Previous thread: [PATCH 2/4] posix timers: sigqueue_free: don't free sigqueue if it is queued by Oleg Nesterov on Saturday, May 3, 2008 - 1:35 pm. (5 messages)

Next thread: [PATCH 0/4] posix timers: misc fixes by Oleg Nesterov on Saturday, May 3, 2008 - 1:35 pm. (1 message)
To: Andrew Morton <akpm@...>
Cc: Austin Clements <amdragon+kernelbugzilla@...>, Ingo Molnar <mingo@...>, john stultz <johnstul@...>, Linus Torvalds <torvalds@...>, Michael Kerrisk <mtk.manpages@...>, Roland McGrath <roland@...>, Thomas Gleixner <tglx@...>, <linux-kernel@...>
Date: Saturday, May 3, 2008 - 1:35 pm

release_posix_timer() can't be called with -&gt;it_process != NULL. Once
sys_timer_create() sets -&gt;it_process it must not call release_posix_timer(),
otherwise we can race with another thread doing sys_timer_delete(), this timer
is visible to idr_find() and unlocked.

The same is true for two other callers (actually, for any possible caller),
sys_timer_delete() and itimer_delete(). They must clear -&gt;it_process before
unlock_timer() + release_posix_timer().

Signed-off-by: Oleg Nesterov &lt;oleg@tv-sign.ru&gt;

--- 25/kernel/posix-timers.c~4_RPT_NO_CHECK	2008-05-03 19:55:27.000000000 +0400
+++ 25/kernel/posix-timers.c	2008-05-03 20:13:36.000000000 +0400
@@ -450,9 +450,6 @@ static void release_posix_timer(struct k
 		spin_unlock_irqrestore(&amp;idr_lock, flags);
 	}
 	sigqueue_free(tmr-&gt;sigq);
-	if (unlikely(tmr-&gt;it_process) &amp;&amp;
-	    tmr-&gt;it_sigev_notify == (SIGEV_SIGNAL|SIGEV_THREAD_ID))
-		put_task_struct(tmr-&gt;it_process);
 	kmem_cache_free(posix_timers_cache, tmr);
 }
 

--
To: Oleg Nesterov <oleg@...>
Cc: Andrew Morton <akpm@...>, Austin Clements <amdragon+kernelbugzilla@...>, Ingo Molnar <mingo@...>, john stultz <johnstul@...>, Linus Torvalds <torvalds@...>, Michael Kerrisk <mtk.manpages@...>, Thomas Gleixner <tglx@...>, <linux-kernel@...>
Date: Monday, May 5, 2008 - 10:34 pm

Signed-off-by: Roland McGrath &lt;roland@redhat.com&gt;
--
Previous thread: [PATCH 2/4] posix timers: sigqueue_free: don't free sigqueue if it is queued by Oleg Nesterov on Saturday, May 3, 2008 - 1:35 pm. (5 messages)

Next thread: [PATCH 0/4] posix timers: misc fixes by Oleg Nesterov on Saturday, May 3, 2008 - 1:35 pm. (1 message)
speck-geostationary