Skip to content

Commit

Permalink
mptcp: avoid lock_fast usage in accept path
Browse files Browse the repository at this point in the history
Once event support is added this may need to allocate memory while msk
lock is held with softirqs disabled.

Not using lock_fast also allows to do the allocation with GFP_KERNEL.

Reviewed-by: Mat Martineau <[email protected]>
Signed-off-by: Florian Westphal <[email protected]>
  • Loading branch information
Florian Westphal authored and jenkins-tessares committed Jan 28, 2021
1 parent 5c072ef commit 6c95082
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions net/mptcp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -3256,9 +3256,8 @@ static int mptcp_stream_accept(struct socket *sock, struct socket *newsock,
struct mptcp_sock *msk = mptcp_sk(newsock->sk);
struct mptcp_subflow_context *subflow;
struct sock *newsk = newsock->sk;
bool slowpath;

slowpath = lock_sock_fast(newsk);
lock_sock(newsk);

/* PM/worker can now acquire the first subflow socket
* lock without racing with listener queue cleanup,
Expand All @@ -3284,7 +3283,7 @@ static int mptcp_stream_accept(struct socket *sock, struct socket *newsock,
if (!ssk->sk_socket)
mptcp_sock_graft(ssk, newsock);
}
unlock_sock_fast(newsk, slowpath);
release_sock(newsk);
}

if (inet_csk_listen_poll(ssock->sk))
Expand Down

0 comments on commit 6c95082

Please sign in to comment.