Skip to content

Commit 7ea9c1e

Browse files
chuckleverkuba-moo
authored andcommitted
net/handshake: Fix handshake_dup() ref counting
If get_unused_fd_flags() fails, we ended up calling fput(sock->file) twice. Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Suggested-by: Paolo Abeni <pabeni@redhat.com> Fixes: 3b3009e ("net/handshake: Create a NETLINK service for handling handshake requests") Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent a095326 commit 7ea9c1e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

net/handshake/netlink.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,16 @@ int handshake_nl_accept_doit(struct sk_buff *skb, struct genl_info *info)
139139
goto out_complete;
140140
}
141141
err = req->hr_proto->hp_accept(req, info, fd);
142-
if (err)
142+
if (err) {
143+
fput(sock->file);
143144
goto out_complete;
145+
}
144146

145147
trace_handshake_cmd_accept(net, req, req->hr_sk, fd);
146148
return 0;
147149

148150
out_complete:
149151
handshake_complete(req, -EIO, NULL);
150-
fput(sock->file);
151152
out_status:
152153
trace_handshake_cmd_accept_err(net, req, NULL, err);
153154
return err;

0 commit comments

Comments
 (0)