Skip to contentSkip to conversation

signals: send_signal: be paranoid about signalfd_notify()

PATCH In review Oleg Nesterov 2 participants 2 messages Mar 12, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 signals: send_signal: be paranoid about signalfd_notify()

send_signal() shouldn't call signalfd_notify() if it then fails with -EAGAIN. Harmless, just a paranoid cleanup.

Also remove the comment. It is obsolete, signalfd_notify() was simplified and does a simple wakeup.

kernel/signal.c renamed from kernel/signal.c~3_SS_NOTIFY +1 -7
@@ -769,13 +769,6 @@ static int send_signal(int sig, struct s
 	 */
 	if (legacy_queue(pending, sig))
 		return 0;
-
-	/*
-	 * Deliver the signal to listening signalfds. This must be called
-	 * with the sighand lock held.
-	 */
-	signalfd_notify(t, sig);
-
 	/*
 	 * fast-pathed signals for kernel-internal things like SIGSTOP
 	 * or SIGKILL.
@@ -825,6 +818,7 @@ static int send_signal(int sig, struct s
 	}
 
 out_set:
+	signalfd_notify(t, sig);
 	sigaddset(&pending->signal, sig);
 	complete_signal(sig, t, group);
 	return 0;
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Oleg Nesterov

send_signal() shouldn't call signalfd_notify() if it then fails with -EAGAIN. Harmless, just a paranoid cleanup.

Also remove the comment. It is obsolete, signalfd_notify() was simplified and does a simple wakeup.

Looks fine to me.

Quoted 19 lines
kernel/signal.c renamed from kernel/signal.c~3_SS_NOTIFY +0 -7
@@ -769,13 +769,6 @@ static int send_signal(int sig, struct s
 	 */
 	if (legacy_queue(pending, sig))
 		return 0;
-
-	/*
-	 * Deliver the signal to listening signalfds. This must be called
-	 * with the sighand lock held.
-	 */
-	signalfd_notify(t, sig);
-
 	/*
 	 * fast-pathed signals for kernel-internal things like SIGSTOP
 	 * or SIGKILL.

kernel/signal.c static int send_signal(int sig, struct s · line 824

Quoted 7 lines
kernel/signal.c renamed from kernel/signal.c~3_SS_NOTIFY +1 -0
@@ -825,6 +818,7 @@ static int send_signal(int sig, struct s
 	}
 
 out_set:
+	signalfd_notify(t, sig);
 	sigaddset(&pending->signal, sig);
 	complete_signal(sig, t, group);
 	return 0;

- Davide