mptcp: cope racing subflow creation in mptcp_rcv_space_adjust
Subsystems (2)
Matthieu Baerts (NGI0)
maintainerPATCH 1/1 mptcp: cope racing subflow creation in mptcp_rcv_space_adjust
From: Paolo Abeni <[email protected]>
commit ce7356ae35943cc6494cc692e62d51a734062b7d upstream.
Additional active subflows - i.e. created by the in kernel path manager - are included into the subflow list before starting the 3whs.
A racing recvmsg() spooling data received on an already established subflow would unconditionally call tcp_cleanup_rbuf() on all the current subflows, potentially hitting a divide by zero error on the newly created ones.
Explicitly check that the subflow is in a suitable state before invoking tcp_cleanup_rbuf().
[ Conflicts in protocol.c, because commit f410cbea9f3d ("tcp: annotate
data-races around tp->window_clamp") has not been backported to this version. The conflict is easy to resolve, because only the context is different, but not the line to modify. ]
--- net/mptcp/protocol.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mptcp/protocol.c +2 -1
@@ -1986,7 +1986,8 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied) slow =lock_sock_fast (ssk);WRITE_ONCE (ssk->sk_rcvbuf, rcvbuf);tcp_sk (ssk)->window_clamp = window_clamp; -tcp_cleanup_rbuf (ssk,1 ); +if (tcp_can_send_ack (ssk)) +tcp_cleanup_rbuf (ssk,1 );unlock_sock_fast (ssk, slow); } }
Signature · 1 line
2.45.2