Skip to content

Commit

Permalink
mptcp: fix setsockopt(IP_TOS) subflow locking
Browse files Browse the repository at this point in the history
The mptcp implementation of the IP_TOS socket option uses the lockless
variant of the TOS manipulation helper and does not hold suck lock at
the helper invocation time.

Add the required locking.

Fixes: ffcacff ("mptcp: Support for IP_TOS for MPTCP setsockopt()")
Closes: multipath-tcp/mptcp_net-next#457
Signed-off-by: Paolo Abeni <[email protected]>
  • Loading branch information
Paolo Abeni authored and intel-lab-lkp committed Nov 8, 2023
1 parent 22dcc06 commit 88da875
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/mptcp/sockopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,8 +738,11 @@ static int mptcp_setsockopt_v4_set_tos(struct mptcp_sock *msk, int optname,
val = READ_ONCE(inet_sk(sk)->tos);
mptcp_for_each_subflow(msk, subflow) {
struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
bool slow;

slow = lock_sock_fast(ssk);
__ip_sock_set_tos(ssk, val);
unlock_sock_fast(ssk, slow);
}
release_sock(sk);

Expand Down

0 comments on commit 88da875

Please sign in to comment.