public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] signal: move print_dropped_signal
@ 2019-12-03 18:02 trix
  0 siblings, 0 replies; only message in thread
From: trix @ 2019-12-03 18:02 UTC (permalink / raw)
  To: ebiederm, christian.brauner, arnd, akpm, guro, deepa.kernel,
	linux-kernel
  Cc: Tom Rix

From: Tom Rix <trix@redhat.com>

If the allocation of 'q' fails, the signal will be dropped.
To ensure that this is reported, move print_dropped_signal to be
inside the '(q == NULL)' if-check.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 kernel/signal.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index bcd46f547db3..294a4625200e 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -427,11 +427,10 @@ __sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimi
 	    atomic_read(&user->sigpending) <=
 			task_rlimit(t, RLIMIT_SIGPENDING)) {
 		q = kmem_cache_alloc(sigqueue_cachep, flags);
-	} else {
-		print_dropped_signal(sig);
 	}
 
 	if (unlikely(q == NULL)) {
+		print_dropped_signal(sig);
 		atomic_dec(&user->sigpending);
 		free_uid(user);
 	} else {
-- 
2.18.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-03 18:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-03 18:02 [PATCH] signal: move print_dropped_signal trix

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