summaryrefslogtreecommitdiffstats
path: root/net/mptcp
diff options
context:
space:
mode:
authorMenglong Dong <imagedong@tencent.com>2023-01-06 10:57:20 -0800
committerDavid S. Miller <davem@davemloft.net>2023-01-09 07:30:50 +0000
commitcfdcfeed6449d702825d249cb85346ecf56236fc (patch)
treee02bc7097d8accc7751a02fb0b25d4a39209a66c /net/mptcp
parent3c976f4c99237bcdab918ad18e7bee3b77e6d316 (diff)
downloadlinux-stable-cfdcfeed6449d702825d249cb85346ecf56236fc.tar.gz
linux-stable-cfdcfeed6449d702825d249cb85346ecf56236fc.tar.bz2
linux-stable-cfdcfeed6449d702825d249cb85346ecf56236fc.zip
mptcp: introduce 'sk' to replace 'sock->sk' in mptcp_listen()
'sock->sk' is used frequently in mptcp_listen(). Therefore, we can introduce the 'sk' and replace 'sock->sk' with it. Acked-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Menglong Dong <imagedong@tencent.com> Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mptcp')
-rw-r--r--net/mptcp/protocol.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 62c140f96d77..1ce003f15d70 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3638,12 +3638,13 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr,
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;
int err;
pr_debug("msk=%p", msk);
- lock_sock(sock->sk);
+ lock_sock(sk);
ssock = __mptcp_nmpc_socket(msk);
if (!ssock) {
err = -EINVAL;
@@ -3651,18 +3652,18 @@ static int mptcp_listen(struct socket *sock, int backlog)
}
mptcp_token_destroy(msk);
- inet_sk_state_store(sock->sk, TCP_LISTEN);
- sock_set_flag(sock->sk, SOCK_RCU_FREE);
+ inet_sk_state_store(sk, TCP_LISTEN);
+ sock_set_flag(sk, SOCK_RCU_FREE);
err = ssock->ops->listen(ssock, backlog);
- inet_sk_state_store(sock->sk, inet_sk_state_load(ssock->sk));
+ inet_sk_state_store(sk, inet_sk_state_load(ssock->sk));
if (!err)
- mptcp_copy_inaddrs(sock->sk, ssock->sk);
+ mptcp_copy_inaddrs(sk, ssock->sk);
mptcp_event_pm_listener(ssock->sk, MPTCP_EVENT_LISTENER_CREATED);
unlock:
- release_sock(sock->sk);
+ release_sock(sk);
return err;
}