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: <0ad3bdc1e5e4ccef2ee0b36fb3b068e61b1b1a53.1684501922.git.asml.silence@gmail.com>
Date: Fri, 19 May 2023 14:33:05 +0100
From: Pavel Begunkov <asml.silence@...il.com>
To: netdev@...r.kernel.org,
	edumazet@...gle.com,
	davem@...emloft.net,
	dsahern@...nel.org,
	pabeni@...hat.com,
	kuba@...nel.org
Cc: Pavel Begunkov <asml.silence@...il.com>
Subject: [PATCH net-next 2/2] net/tcp: optimise non error splice paths

Move post __tcp_splice_read() error checking inside the "nothing to
read" block. That removes an extra if from the path where it has
successfully spliced some bytes.

Signed-off-by: Pavel Begunkov <asml.silence@...il.com>
---
 net/ipv4/tcp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index bf7627f37e69..0139b2c70ed4 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -799,9 +799,9 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos,
 	timeo = sock_rcvtimeo(sk, sock->file->f_flags & O_NONBLOCK);
 	while (true) {
 		ret = __tcp_splice_read(sk, &tss);
-		if (ret < 0)
-			break;
-		else if (!ret) {
+		if (ret <= 0) {
+			if (unlikely(ret < 0))
+				break;
 			if (spliced)
 				break;
 			if (sock_flag(sk, SOCK_DONE))
-- 
2.40.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ