Skip to content

Commit

Permalink
net/handshake: Fix handshake_dup() ref counting
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chuck Lever authored and Jakub Kicinski committed May 25, 2023
1 parent a095326 commit 7ea9c1e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/handshake/netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7ea9c1e

Please sign in to comment.