Commit 40f56d0c authored by Paolo Abeni's avatar Paolo Abeni Committed by David S. Miller

mptcp: avoid additional indirection in mptcp_listen()

We are going to remove the first subflow socket soon, so avoid
the additional indirection via at listen() time. Instead call
directly the recently introduced helper on the first subflow sock.

No functional changes intended.
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 71a9a874
...@@ -3720,6 +3720,7 @@ static int mptcp_listen(struct socket *sock, int backlog) ...@@ -3720,6 +3720,7 @@ static int mptcp_listen(struct socket *sock, int backlog)
struct mptcp_sock *msk = mptcp_sk(sock->sk); struct mptcp_sock *msk = mptcp_sk(sock->sk);
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct socket *ssock; struct socket *ssock;
struct sock *ssk;
int err; int err;
pr_debug("msk=%p", msk); pr_debug("msk=%p", msk);
...@@ -3736,15 +3737,19 @@ static int mptcp_listen(struct socket *sock, int backlog) ...@@ -3736,15 +3737,19 @@ static int mptcp_listen(struct socket *sock, int backlog)
goto unlock; goto unlock;
} }
ssk = msk->first;
inet_sk_state_store(sk, TCP_LISTEN); inet_sk_state_store(sk, TCP_LISTEN);
sock_set_flag(sk, SOCK_RCU_FREE); sock_set_flag(sk, SOCK_RCU_FREE);
err = READ_ONCE(ssock->ops)->listen(ssock, backlog); lock_sock(ssk);
inet_sk_state_store(sk, inet_sk_state_load(ssock->sk)); err = __inet_listen_sk(ssk, backlog);
release_sock(ssk);
inet_sk_state_store(sk, inet_sk_state_load(ssk));
if (!err) { if (!err) {
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
mptcp_copy_inaddrs(sk, ssock->sk); mptcp_copy_inaddrs(sk, ssk);
mptcp_event_pm_listener(ssock->sk, MPTCP_EVENT_LISTENER_CREATED); mptcp_event_pm_listener(ssk, MPTCP_EVENT_LISTENER_CREATED);
} }
unlock: unlock:
......
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