Commit cfdcfeed authored by Menglong Dong's avatar Menglong Dong Committed by David S. Miller

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: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarMenglong Dong <imagedong@tencent.com>
Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3c976f4c
...@@ -3638,12 +3638,13 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr, ...@@ -3638,12 +3638,13 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr,
static int mptcp_listen(struct socket *sock, int backlog) 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 socket *ssock; struct socket *ssock;
int err; int err;
pr_debug("msk=%p", msk); pr_debug("msk=%p", msk);
lock_sock(sock->sk); lock_sock(sk);
ssock = __mptcp_nmpc_socket(msk); ssock = __mptcp_nmpc_socket(msk);
if (!ssock) { if (!ssock) {
err = -EINVAL; err = -EINVAL;
...@@ -3651,18 +3652,18 @@ static int mptcp_listen(struct socket *sock, int backlog) ...@@ -3651,18 +3652,18 @@ static int mptcp_listen(struct socket *sock, int backlog)
} }
mptcp_token_destroy(msk); mptcp_token_destroy(msk);
inet_sk_state_store(sock->sk, TCP_LISTEN); inet_sk_state_store(sk, TCP_LISTEN);
sock_set_flag(sock->sk, SOCK_RCU_FREE); sock_set_flag(sk, SOCK_RCU_FREE);
err = ssock->ops->listen(ssock, backlog); 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) 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); mptcp_event_pm_listener(ssock->sk, MPTCP_EVENT_LISTENER_CREATED);
unlock: unlock:
release_sock(sock->sk); release_sock(sk);
return err; return err;
} }
......
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