Commit 2200c1a8 authored by Chuck Lever's avatar Chuck Lever Committed by David S. Miller

net/handshake: Fix handshake_dup() ref counting

If get_unused_fd_flags() fails, we ended up calling fput(sock->file)
twice.
Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Suggested-by: default avatarPaolo Abeni <pabeni@redhat.com>
Fixes: 3b3009ea ("net/handshake: Create a NETLINK service for handling handshake requests")
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b16d76fe
...@@ -139,15 +139,16 @@ int handshake_nl_accept_doit(struct sk_buff *skb, struct genl_info *info) ...@@ -139,15 +139,16 @@ int handshake_nl_accept_doit(struct sk_buff *skb, struct genl_info *info)
goto out_complete; goto out_complete;
} }
err = req->hr_proto->hp_accept(req, info, fd); err = req->hr_proto->hp_accept(req, info, fd);
if (err) if (err) {
fput(sock->file);
goto out_complete; goto out_complete;
}
trace_handshake_cmd_accept(net, req, req->hr_sk, fd); trace_handshake_cmd_accept(net, req, req->hr_sk, fd);
return 0; return 0;
out_complete: out_complete:
handshake_complete(req, -EIO, NULL); handshake_complete(req, -EIO, NULL);
fput(sock->file);
out_status: out_status:
trace_handshake_cmd_accept_err(net, req, NULL, err); trace_handshake_cmd_accept_err(net, req, NULL, err);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment