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]
Date:	Mon,  9 Mar 2015 14:19:56 -0700
From:	Maciej Żenczykowski <zenczykowski@...il.com>
To:	Maciej Żenczykowski <maze@...gle.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>
Cc:	Theodore Ts'o <tytso@....edu>, netdev@...r.kernel.org
Subject: [PATCH 1/8] net/socket: sock_map_fd - reverse error handling logic

From: Maciej Żenczykowski <maze@...gle.com>

functional no-op, but easier to read

Signed-off-by: Maciej Żenczykowski <maze@...gle.com>
---
 net/socket.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index 95d3085cb477..323ebd530b88 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -397,13 +397,13 @@ static int sock_map_fd(struct socket *sock, int flags)
 		return fd;
 
 	newfile = sock_alloc_file(sock, flags, NULL);
-	if (likely(!IS_ERR(newfile))) {
-		fd_install(fd, newfile);
-		return fd;
+	if (unlikely(IS_ERR(newfile))) {
+		put_unused_fd(fd);
+		return PTR_ERR(newfile);
 	}
 
-	put_unused_fd(fd);
-	return PTR_ERR(newfile);
+	fd_install(fd, newfile);
+	return fd;
 }
 
 struct socket *sock_from_file(struct file *file, int *err)
-- 
2.2.0.rc0.207.ga3a616c

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ