[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<168382005054.84244.14487543591680880365.stgit@91.116.238.104.host.secureserver.net>
Date: Thu, 11 May 2023 11:47:40 -0400
From: Chuck Lever <cel@...nel.org>
To: netdev@...r.kernel.org
Cc: kernel-tls-handshake@...ts.linux.dev, dan.carpenter@...aro.org,
chuck.lever@...cle.com
Subject: [PATCH v3 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>
Suggested-by: Paolo Abeni <pabeni@...hat.com>
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 | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/handshake/netlink.c b/net/handshake/netlink.c
index 7ec8a76c3c8a..f5dc170689d9 100644
--- a/net/handshake/netlink.c
+++ b/net/handshake/netlink.c
@@ -139,15 +139,16 @@ int handshake_nl_accept_doit(struct sk_buff *skb, struct genl_info *info)
goto out_complete;
}
err = req->hr_proto->hp_accept(req, info, fd);
- if (err)
+ if (err) {
+ fput(sock->file);
goto out_complete;
+ }
trace_handshake_cmd_accept(net, req, req->hr_sk, fd);
return 0;
out_complete:
handshake_complete(req, -EIO, NULL);
- fput(sock->file);
out_status:
trace_handshake_cmd_accept_err(net, req, NULL, err);
return err;
Powered by blists - more mailing lists