aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/signal.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index 12ffea7c201d..2955f6c4f36e 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1240,18 +1240,22 @@ void sigqueue_free(struct sigqueue *q)
1240 1240
1241 BUG_ON(!(q->flags & SIGQUEUE_PREALLOC)); 1241 BUG_ON(!(q->flags & SIGQUEUE_PREALLOC));
1242 /* 1242 /*
1243 * If the signal is still pending remove it from the 1243 * We must hold ->siglock while testing q->list
1244 * pending queue. We must hold ->siglock while testing 1244 * to serialize with collect_signal() or with
1245 * q->list to serialize with collect_signal() or with
1246 * __exit_signal()->flush_sigqueue(). 1245 * __exit_signal()->flush_sigqueue().
1247 */ 1246 */
1248 spin_lock_irqsave(lock, flags); 1247 spin_lock_irqsave(lock, flags);
1248 q->flags &= ~SIGQUEUE_PREALLOC;
1249 /*
1250 * If it is queued it will be freed when dequeued,
1251 * like the "regular" sigqueue.
1252 */
1249 if (!list_empty(&q->list)) 1253 if (!list_empty(&q->list))
1250 list_del_init(&q->list); 1254 q = NULL;
1251 spin_unlock_irqrestore(lock, flags); 1255 spin_unlock_irqrestore(lock, flags);
1252 1256
1253 q->flags &= ~SIGQUEUE_PREALLOC; 1257 if (q)
1254 __sigqueue_free(q); 1258 __sigqueue_free(q);
1255} 1259}
1256 1260
1257int send_sigqueue(struct sigqueue *q, struct task_struct *t, int group) 1261int send_sigqueue(struct sigqueue *q, struct task_struct *t, int group)