lkml.org 
[lkml]   [2018]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1 05/20] signal: flatten do_send_sig_info()
Date
Let's return early when lock_task_sighand() fails and move send_signal()
and unlock_task_sighand() out of the if block.

Signed-off-by: Christian Brauner <christian@brauner.io>
---
v0->v1:
* patch unchanged
---
kernel/signal.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index baae137455eb..a628b56415e6 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1167,16 +1167,16 @@ specific_send_sig_info(int sig, struct siginfo *info, struct task_struct *t)
}

int do_send_sig_info(int sig, struct siginfo *info, struct task_struct *p,
- bool group)
+ bool group)
{
unsigned long flags;
int ret = -ESRCH;

- if (lock_task_sighand(p, &flags)) {
- ret = send_signal(sig, info, p, group);
- unlock_task_sighand(p, &flags);
- }
+ if (!lock_task_sighand(p, &flags))
+ return ret;

+ ret = send_signal(sig, info, p, group);
+ unlock_task_sighand(p, &flags);
return ret;
}

--
2.17.0
\
 
 \ /
  Last update: 2018-05-29 00:02    [W:0.107 / U:18.760 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site