Skip to contentSkip to conversation

signal: move print_dropped_signal

PATCH New [email protected] 1 participant 1 message Dec 3, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 signal: move print_dropped_signal

From: Tom Rix <[email protected]>

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.

---
 kernel/signal.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/signal.c +1 -2
index bcd46f547db3..294a4625200e 100644
@@ -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 {
Signature · 1 line
2.18.1