Skip to content

Commit 35bb480

Browse files
matttbegregkh
authored andcommitted
mptcp: only reset subflow errors when propagated
commit dccf461 upstream. Some subflow socket errors need to be reported to the MPTCP socket: the initial subflow connect (MP_CAPABLE), and the ones from the fallback sockets. The others are not propagated. The issue is that sock_error() was used to retrieve the error, which was also resetting the sk_err field. Because of that, when notifying the userspace about subflow close events later on from the MPTCP worker, the ssk->sk_err field was always 0. Now, the error (sk_err) is only reset when propagating it to the msk. Fixes: 15cc104 ("mptcp: deliver ssk errors to msk") Cc: stable@vger.kernel.org Reviewed-by: Geliang Tang <geliang@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260127-net-mptcp-dup-nl-events-v1-3-7f71e1bc4feb@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 33f9714 commit 35bb480

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

net/mptcp/protocol.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -784,18 +784,19 @@ static bool __mptcp_ofo_queue(struct mptcp_sock *msk)
784784

785785
static bool __mptcp_subflow_error_report(struct sock *sk, struct sock *ssk)
786786
{
787-
int err = sock_error(ssk);
788787
int ssk_state;
789-
790-
if (!err)
791-
return false;
788+
int err;
792789

793790
/* only propagate errors on fallen-back sockets or
794791
* on MPC connect
795792
*/
796793
if (sk->sk_state != TCP_SYN_SENT && !__mptcp_check_fallback(mptcp_sk(sk)))
797794
return false;
798795

796+
err = sock_error(ssk);
797+
if (!err)
798+
return false;
799+
799800
/* We need to propagate only transition to CLOSE state.
800801
* Orphaned socket will see such state change via
801802
* subflow_sched_work_if_closed() and that path will properly

0 commit comments

Comments
 (0)