[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<168333395123.7813.7077088598355438510.stgit@oracle-102.nfsv4bat.org>
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