summaryrefslogtreecommitdiff
path: root/net/mptcp/protocol.c
diff options
context:
space:
mode:
authorPaolo Abeni <pabeni@redhat.com>2023-08-11 18:57:20 +0300
committerDavid S. Miller <davem@davemloft.net>2023-08-14 09:06:13 +0300
commit40f56d0c7043d16e9d49d1df6c02804c09ed5cd6 (patch)
tree983dc1084ed7a5e472a92602045aa04cfc627986 /net/mptcp/protocol.c
parent71a9a874cd6beb074896519f762741fbc448f5be (diff)
downloadlinux-40f56d0c7043d16e9d49d1df6c02804c09ed5cd6.tar.xz
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: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Mat Martineau <martineau@kernel.org> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mptcp/protocol.c')
-rw-r--r--net/mptcp/protocol.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 5b4d6f0628a7..d8b75fbc4f24 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3720,6 +3720,7 @@ static int mptcp_listen(struct socket *sock, int backlog)
struct mptcp_sock *msk = mptcp_sk(sock->sk);
struct sock *sk = sock->sk;
struct socket *ssock;
+ struct sock *ssk;
int err;
pr_debug("msk=%p", msk);
@@ -3736,15 +3737,19 @@ static int mptcp_listen(struct socket *sock, int backlog)
goto unlock;
}
+ ssk = msk->first;
inet_sk_state_store(sk, TCP_LISTEN);
sock_set_flag(sk, SOCK_RCU_FREE);
- err = READ_ONCE(ssock->ops)->listen(ssock, backlog);
- inet_sk_state_store(sk, inet_sk_state_load(ssock->sk));
+ lock_sock(ssk);
+ err = __inet_listen_sk(ssk, backlog);
+ release_sock(ssk);
+ inet_sk_state_store(sk, inet_sk_state_load(ssk));
+
if (!err) {
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
- mptcp_copy_inaddrs(sk, ssock->sk);
- mptcp_event_pm_listener(ssock->sk, MPTCP_EVENT_LISTENER_CREATED);
+ mptcp_copy_inaddrs(sk, ssk);
+ mptcp_event_pm_listener(ssk, MPTCP_EVENT_LISTENER_CREATED);
}
unlock: