summaryrefslogtreecommitdiff
path: root/net/mptcp/subflow.c
diff options
context:
space:
mode:
authorPaolo Abeni <pabeni@redhat.com>2021-01-20 17:39:10 +0300
committerJakub Kicinski <kuba@kernel.org>2021-01-23 06:21:02 +0300
commit866f26f2a9c33bc70eb0f07ffc37fd9424ffe501 (patch)
tree2314f01e3fdbdc52dd4c9178cd0f42f2d701d8e3 /net/mptcp/subflow.c
parente26ca4b535820b1445dcef3c0f82b3fb5b45108b (diff)
downloadlinux-866f26f2a9c33bc70eb0f07ffc37fd9424ffe501.tar.xz
mptcp: always graft subflow socket to parent
Currently, incoming subflows link to the parent socket, while outgoing ones link to a per subflow socket. The latter is not really needed, except at the initial connect() time and for the first subflow. Always graft the outgoing subflow to the parent socket and free the unneeded ones early. This allows some code cleanup, reduces the amount of memory used and will simplify the next patch Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/mptcp/subflow.c')
-rw-r--r--net/mptcp/subflow.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 278cbe3e539e..22313710d769 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -1159,6 +1159,9 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
if (err && err != -EINPROGRESS)
goto failed_unlink;
+ /* discard the subflow socket */
+ mptcp_sock_graft(ssk, sk->sk_socket);
+ iput(SOCK_INODE(sf));
return err;
failed_unlink: