Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796107768; b=CQBwSE4mWbLBskLo/qzfJue8ZAX1/U38G7I0XdnhMtZi8n8r04r0coyUxgB5ksmr75UM 59UbBvGUjOPs9kI+6IVMT0rCmyj3fsQEJGwv+kC5/q/e4Znw7vLr0DPdY1Zykgd1UukC9 EA9p9lHbVXEh33UJJDF+Uuj1/j/LZDOcyEfcbUAJQl/e+pQAQQzP0nAmqCBFyvzNwYGRM dfv/l4PXeuX4z9/dSW+75dOdRwVPkGzBmBkTQCeFirTyvBpHwgTXnl8SeEYMRLWXoNKdR aphNSUJNwmC540ASDERNzwYhLWfzC1V6x4Opf3Ihf2c98OG+0aMmmUkNAed+68gpcMw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796107768; h=Received:DKIM-Signature:Message-ID:Subject:From:To:In-Reply-To: References:Content-Type:MIME-Version:Date:User-Agent: Content-Transfer-Encoding; bh=03eBnxUYsO2SO4nQmCh11XMiLR91u0sckE259CzZfKY=; b=kiRWomMh/FtEBzvmuVYTpntrpr+9DpTD+vdTDffD3ZUyDYR4ENp8a2qu/b2aDXQYVZwg XGuXOFflLgls1Rk3S9mEB9mTRkWk3rfun1X1NWGELz+e9gWFzHX6NVaj++2W5P1urWK9O T4sUGo4xvNaqwyLM7fhq3+no86VPuIszQzkzYZr1CFs/M9/K+KunFO9h4VCR6PA7uJWl8 kxf4Jw1cXZIWR/CF836lTCoVlLpjm3o0J7onaAwtHJ9fxuBijIdqM9FHfXIGgCV3cJRWA pexpKJ8Oc4RImIslyQ29wfLJLLWY1H8ZM26yEOjfZpzaXNaesSmGx0lLb/YCs4uUgLg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LZoznFGr; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DD5E606A69F for ; Tue, 1 Dec 2026 06:49:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LZoznFGr Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56F7A1F0089F; Tue, 1 Dec 2026 06:49:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796107768; bh=03eBnxUYsO2SO4nQmCh11XMiLR91u0sckE259CzZfKY=; h=Subject:From:To:In-Reply-To:References:Date; b=LZoznFGrQyaOI+eDyWYWwZi419+ypeWkgo9v6YU8SPo3VSZ1WnoEkfneIbVGwNcW9 UWKFpznFJ3dTN1s+U3ZHSInU2wiarvbguwKfgSbLU64S6Lop3zlh2OObsyIzdtEVuY /7ix4Fz+nX23TcxzS0E07odw2+jPJ3mU05O1ZtlaPyDR6reRr1Zqm6eX0nPoE8aRq6 vuyFptvXhYPjFgRWJb2N8fYeR3v3MhD/c3zaOlqapb/VKyh2RJf1142Eg83gwB8ITA NX1+1dhV7ljqj17F1kb8LOMbCi29dtqVT3KqAYxPBc90Mv7hiBHBwdq6J72oNlTTc/ ckqu+GWbSHx0g== Message-ID: <424fadb87727a8fed422f0cc893f7b43a8702457.camel@kernel.org> Subject: Re: [PATCH mptcp-net v3 14/50] mptcp: report errors received before accept() From: Geliang Tang To: "Matthieu Baerts (NGI0)" , MPTCP Linux In-Reply-To: <20261124-mptcp-cmason-fixes-v3-14-416c0920c73f@kernel.org> References: <20261124-mptcp-cmason-fixes-v3-0-416c0920c73f@kernel.org> <20261124-mptcp-cmason-fixes-v3-14-416c0920c73f@kernel.org> Content-Type: text/plain; charset="UTF-8" X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Date: Fri, 27 Nov 2026 09:02:57 +0800 User-Agent: Evolution 3.56.2-10build1 Content-Transfer-Encoding: 7bit Hi Matt, On Tue, 2026-11-24 at 22:59 +0100, Matthieu Baerts (NGI0) wrote: > After a fallback to TCP, when the subflow of a new MPTCP socket has been > reset before accept(), and the worker processed it before accept() too, > the error was lost: read() returned EOF after the data, instead of > ECONNRESET, and after a FIN followed by a reset, SO_ERROR was not set to > EPIPE, as TCP does. > > subflow_error_report() skips the MPTCP sockets in the accept queue, > without a socket attached. Before v6.19, the error was then reported > when accept() closed the subflow again. Since the commit below, > mptcp_close_ssk() is used there, which skips this subflow, already > disconnected, since commit 280d654324e3 ("mptcp: avoid dup SUB_CLOSED > events after disconnect"). > > At accept() time, when the subflow has already been closed, report its > error, after having processed the pending close events. > > This issue has been found by an AI code review agent (Clashiko), while > reviewing the previous commit, and confirmed with a new Packetdrill > test: after a fallback, data and a reset are received before accept(). > Without this patch, the second read() returned EOF: > > v1_bind_tcpfallback_reset_before_accept.pkt:21: runtime error in read call: Expected result -1 but got 0 with errno 22 (Invalid argument) > > Fixes: 48a395605e08 ("mptcp: do not miss early first subflow close event notification") > Signed-off-by: Matthieu Baerts (NGI0) Looks good to me! Reviewed-by: Geliang Tang Thanks, -Geliang > --- > v3: new, for an issue spotted by Clashiko > --- > net/mptcp/protocol.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c > index 8edff68ec650..ff1dcf306723 100644 > --- a/net/mptcp/protocol.c > +++ b/net/mptcp/protocol.c > @@ -4705,6 +4705,8 @@ static int mptcp_stream_accept(struct socket *sock, struct socket *newsock, > if (unlikely(inet_sk_state_load(msk->first) == TCP_CLOSE)) { > if (unlikely(list_is_singular(&msk->conn_list))) { > mptcp_check_rcv_close(newsk); > + /* not reported in the accept queue */ > + __mptcp_error_report(newsk); > mptcp_set_state(newsk, TCP_CLOSE); > } > mptcp_close_ssk(newsk, msk->first,