]> git.baikalelectronics.ru Git - kernel.git/commit
mptcp: wake-up readers only for in sequence data
authorPaolo Abeni <pabeni@redhat.com>
Thu, 10 Jun 2021 22:59:41 +0000 (15:59 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 10 Jun 2021 23:47:44 +0000 (16:47 -0700)
commit3699cfd7b491aff5afacdb58753e976eb3c2d6c1
tree6e9c1abe8206b353d21f387100e429a36d785c52
parent1afcdc8ce894224b24f00bedd3e5b4066b03885c
mptcp: wake-up readers only for in sequence data

Currently we rely on the subflow->data_avail field, which is subject to
races:

ssk1
skb len = 500 DSS(seq=1, len=1000, off=0)
# data_avail == MPTCP_SUBFLOW_DATA_AVAIL

ssk2
skb len = 500 DSS(seq = 501, len=1000)
# data_avail == MPTCP_SUBFLOW_DATA_AVAIL

ssk1
skb len = 500 DSS(seq = 1, len=1000, off =500)
# still data_avail == MPTCP_SUBFLOW_DATA_AVAIL,
# as the skb is covered by a pre-existing map,
# which was in-sequence at reception time.

Instead we can explicitly check if some has been received in-sequence,
propagating the info from __mptcp_move_skbs_from_subflow().

Additionally add the 'ONCE' annotation to the 'data_avail' memory
access, as msk will read it outside the subflow socket lock.

Fixes: 70105a1bbb51 ("mptcp: Implement MPTCP receive path")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mptcp/protocol.c
net/mptcp/protocol.h
net/mptcp/subflow.c