]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mptcp: Do not return EINPROGRESS when subflow creation succeeds
authorMat Martineau <mathew.j.martineau@linux.intel.com>
Mon, 25 Jul 2022 20:52:31 +0000 (13:52 -0700)
committerJakub Kicinski <kuba@kernel.org>
Wed, 27 Jul 2022 02:57:55 +0000 (19:57 -0700)
New subflows are created within the kernel using O_NONBLOCK, so
EINPROGRESS is the expected return value from kernel_connect().
__mptcp_subflow_connect() has the correct logic to consider EINPROGRESS
to be a successful case, but it has also used that error code as its
return value.

Before v5.19 this was benign: all the callers ignored the return
value. Starting in v5.19 there is a MPTCP_PM_CMD_SUBFLOW_CREATE generic
netlink command that does use the return value, so the EINPROGRESS gets
propagated to userspace.

Make __mptcp_subflow_connect() always return 0 on success instead.

Fixes: 8e381f2c7ea7 ("mptcp: Add handling of outgoing MP_JOIN requests")
Fixes: 33ecd4cecca3 ("mptcp: netlink: allow userspace-driven subflow establishment")
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Link: https://lore.kernel.org/r/20220725205231.87529-1-mathew.j.martineau@linux.intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mptcp/subflow.c

index 63e8892ec807d33a2dd0070e87902fd6a2289837..af28f3b6038994214ea542dbe29dd3ebe85b6b72 100644 (file)
@@ -1533,7 +1533,7 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
        mptcp_sock_graft(ssk, sk->sk_socket);
        iput(SOCK_INODE(sf));
        WRITE_ONCE(msk->allow_infinite_fallback, false);
-       return err;
+       return 0;
 
 failed_unlink:
        list_del(&subflow->node);