lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180528215355.16119-6-christian@brauner.io>
Date:   Mon, 28 May 2018 23:53:40 +0200
From:   Christian Brauner <christian@...uner.io>
To:     linux-kernel@...r.kernel.org
Cc:     ebiederm@...ssion.com, gregkh@...uxfoundation.org,
        mingo@...nel.org, james.morris@...rosoft.com,
        keescook@...omium.org, peterz@...radead.org, sds@...ho.nsa.gov,
        viro@...iv.linux.org.uk, akpm@...ux-foundation.org,
        oleg@...hat.com, Christian Brauner <christian@...uner.io>
Subject: [PATCH v1 05/20] signal: flatten do_send_sig_info()

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@...uner.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ