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: Fri, 05 May 2023 20:46:01 -0400
From: Chuck Lever <cel@...nel.org>
To: kernel-tls-handshake@...ts.linux.dev
Cc: netdev@...r.kernel.org, dan.carpenter@...aro.org
Subject: [PATCH v2 2/6] net/handshake: Fix handshake_dup() ref counting

From: Chuck Lever <chuck.lever@...cle.com>

If get_unused_fd_flags() fails, we ended up calling fput(sock->file)
twice.

Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
Fixes: 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests")
Signed-off-by: Chuck Lever <chuck.lever@...cle.com>
---
 net/handshake/netlink.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/handshake/netlink.c b/net/handshake/netlink.c
index 7ec8a76c3c8a..032d96152e2f 100644
--- a/net/handshake/netlink.c
+++ b/net/handshake/netlink.c
@@ -101,10 +101,8 @@ static int handshake_dup(struct socket *sock)
 
 	file = get_file(sock->file);
 	newfd = get_unused_fd_flags(O_CLOEXEC);
-	if (newfd < 0) {
-		fput(file);
+	if (newfd < 0)
 		return newfd;
-	}
 
 	fd_install(newfd, file);
 	return newfd;



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ