Skip to content

Commit

Permalink
mptcp: silence warning in subflow_data_ready()
Browse files Browse the repository at this point in the history
since commit d47a721 ("mptcp: fix race in subflow_data_ready()"), it
is possible to observe a regression in MP_JOIN kselftests. For sockets in
TCP_CLOSE state, it's not sufficient to just wake up the main socket: we
also need to ensure that received data are made available to the reader.
Silence the WARN_ON_ONCE() in these cases: it preserves the syzkaller fix
and restores kselftests	when they are ran as follows:

  # while true; do
  > make KBUILD_OUTPUT=/tmp/kselftest TARGETS=net/mptcp kselftest
  > done

Reported-by: Florian Westphal <fw@strlen.de>
Fixes: d47a721 ("mptcp: fix race in subflow_data_ready()")
Closes: #47
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
  • Loading branch information
dcaratti authored and matttbe committed Jul 16, 2020
1 parent 96de990 commit cfbadb2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/mptcp/subflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,18 +869,19 @@ void mptcp_space(const struct sock *ssk, int *space, int *full_space)
static void subflow_data_ready(struct sock *sk)
{
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
u16 state = 1 << inet_sk_state_load(sk);
struct sock *parent = subflow->conn;
struct mptcp_sock *msk;

msk = mptcp_sk(parent);
if ((1 << inet_sk_state_load(sk)) & (TCPF_LISTEN | TCPF_CLOSE)) {
if (state & TCPF_LISTEN) {
set_bit(MPTCP_DATA_READY, &msk->flags);
parent->sk_data_ready(parent);
return;
}

WARN_ON_ONCE(!__mptcp_check_fallback(msk) && !subflow->mp_capable &&
!subflow->mp_join);
!subflow->mp_join && !(state & TCPF_CLOSE));

if (mptcp_subflow_data_available(sk))
mptcp_data_ready(parent, sk);
Expand Down

0 comments on commit cfbadb2

Please sign in to comment.