File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -200,20 +200,12 @@ static void __exit_signal(struct task_struct *tsk)
200
200
__unhash_process (tsk , group_dead );
201
201
write_sequnlock (& sig -> stats_lock );
202
202
203
- /*
204
- * Do this under ->siglock, we can race with another thread
205
- * doing sigqueue_free() if we have SIGQUEUE_PREALLOC signals.
206
- */
207
- flush_sigqueue (& tsk -> pending );
208
203
tsk -> sighand = NULL ;
209
204
spin_unlock (& sighand -> siglock );
210
205
211
206
__cleanup_sighand (sighand );
212
- clear_tsk_thread_flag (tsk , TIF_SIGPENDING );
213
- if (group_dead ) {
214
- flush_sigqueue (& sig -> shared_pending );
207
+ if (group_dead )
215
208
tty_kref_put (tty );
216
- }
217
209
}
218
210
219
211
static void delayed_put_task_struct (struct rcu_head * rhp )
@@ -279,6 +271,16 @@ void release_task(struct task_struct *p)
279
271
proc_flush_pid (thread_pid );
280
272
put_pid (thread_pid );
281
273
release_thread (p );
274
+ /*
275
+ * This task was already removed from the process/thread/pid lists
276
+ * and lock_task_sighand(p) can't succeed. Nobody else can touch
277
+ * ->pending or, if group dead, signal->shared_pending. We can call
278
+ * flush_sigqueue() lockless.
279
+ */
280
+ flush_sigqueue (& p -> pending );
281
+ if (thread_group_leader (p ))
282
+ flush_sigqueue (& p -> signal -> shared_pending );
283
+
282
284
put_task_struct_rcu_user (p );
283
285
284
286
p = leader ;
You can’t perform that action at this time.
0 commit comments