From mboxrd@z Thu Jan 1 00:00:00 1970 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=1796520530; b=qDPM6SXS0/ZbRCNijbYdfzi9TmE8W1bogK/yOp3eM+wiBTW+Me65gJz8w280h489nIyK YNQtDmv0sLI6qf9ixw3p70zEr/GyTmlBtc5hHoxrDmDqdSLsvzRBDXLH1PsrYOTYSoFlE aMHz0uoxkWxJkP0wLTQ9Dt+96pPAkrcL2SpEZkOAVCkFBFQMtwUHEkYX/VzOARW7Inrou xRLUH4WjPnVCantFyvwblrrK13wrXQ3GVEk0I33UuB6SgM10RkEihC9MlMyyYm0vRtIog DGXFHD+u5QFCjFXsctw5hJGJG/juJMOnsiupdsuzu5oD/z2PPym7ybtDLxVMW3o2FGA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796520530; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=GUeSYw7NjC3bRLgeucu/ImjhHiU6pdJkDMuDZ8ydi+o=; b=m3WcVHzWoppwcEp6o6ZIMDawsH6Afdkh+08grviXABlmS+58qgpE5c3/NBdVDQnl966N dy+NBhWxJ5EcYubQPNcCjhbmMuarS8RiJZCpSN3M7r8dEe9WGNMJWgpKs10raCFBzFau8 uJ1MdReL50svZz3mX2rWHuhbG7Es2LF7kCtl8reu9/h4/eV6pK9FGdz1oJUkcDoxgO4Ve wp82q2tpkQETnR33IL88R86qgkVqB64RhWyOBzEJqvBWpNF706RP+Ox1LjELvsvTrFVZC +y1SsUdv6UmIjHRblydMug/CR8b99449Q7BLmruNLFELZSGQdbWZ0soqkvykjxb2jLQ== 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=fCjRNqcx; 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 6B76C606A31F for ; Sun, 6 Dec 2026 01:28:50 +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=fCjRNqcx Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5EED1F0092B; Sun, 6 Dec 2026 01:28:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796520530; bh=GUeSYw7NjC3bRLgeucu/ImjhHiU6pdJkDMuDZ8ydi+o=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=fCjRNqcxljeIpKL8VwkmA2K3jCWkSc0dsZrGI5pmzGkeERNXTyVFB0/rZ30rXpreL zULxZyoSpXmQWOdNxoJG3yLA6c/JDcuLetGI7gIc7wzT87AFTG+8cfNPBZ16Rn/JCI doZmob4WvDb7G7dHPqBkKs7wSrUtCOMR3ap5w1gTWw78upMmj7rA9wq687tVrFgP/B ZfU4y+Jo6Ve6FvvulJRwt9BX9mry8Phxljju6tHVG7D7Bb5xPKZnlEj1POmzwnjq6A LF6O0ViFAsGAOwbwnBylNqdK9FZIwBb0BhDRESJYCpwq0XBBmcofswGocekoTu6D1q CiaDqGBIYLCUw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH mptcp-next v9] mptcp: count the DATA_FIN in mptcp_inq_hint Reply-To: sashiko-reviews@lists.linux.dev To: "Geliang Tang" , mptcp@lists.linux.dev In-Reply-To: <30e3f1d6eabedf2cc62dbb742d48983187c90ffd.1796518897.git.tanggeliang@kylinos.cn> References: <30e3f1d6eabedf2cc62dbb742d48983187c90ffd.1796518897.git.tanggeliang@kylinos.cn> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 06 Dec 2026 01:28:49 +0000 X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] mptcp: mptcp_recvmsg() can return EOF instead of ECONNRESET on fallback RST - [Low] mptcp: mptcp_splice_read() skips pending DATA_FIN processing -- commit 2c5b77605c15fa6fb81035b488f9f109e3948643 Author: Geliang Tang mptcp: count the DATA_FIN in mptcp_inq_hint This commit adds the DATA_FIN byte to mptcp_inq_hint() when SOCK_DONE is set or a pending EOF is detected, and processes pending DATA_FINs synchronously in mptcp_recvmsg(). > diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c > index 14fca55d46199..7ae33bfd2d448 100644 > --- a/net/mptcp/protocol.c > +++ b/net/mptcp/protocol.c [ ... ] > @@ -2480,22 +2495,15 @@ static bool mptcp_move_skbs(struct sock *sk) > static unsigned int mptcp_inq_hint(const struct sock *sk) > { > const struct mptcp_sock *msk =3D mptcp_sk(sk); > - const struct sk_buff *skb; > - > - skb =3D skb_peek(&sk->sk_receive_queue); > - if (skb) { > - u64 hint_val =3D mptcp_data_avail(msk); > + u64 hint_val =3D mptcp_data_avail(msk); > =20 > - if (hint_val >=3D INT_MAX) > - return INT_MAX; > - > - return (unsigned int)hint_val; > - } > + if (hint_val >=3D INT_MAX) > + return INT_MAX; > =20 > - if (sock_flag(sk, SOCK_DONE)) > - return 1; > + if (sock_flag(sk, SOCK_DONE) || mptcp_pending_eof(sk, NULL)) > + hint_val +=3D 1; > =20 > - return 0; > + return (unsigned int)hint_val; > } [Severity: Low] Does mptcp_splice_read() also need to process a pending DATA_FIN synchronously? A zero-length recvmsg() with TCP_INQ skips the receive loop in mptcp_recvmsg() without calling mptcp_check_data_fin(), yet mptcp_inq_hint() still advertises the pending EOF byte via mptcp_pending_eof(). If userspace then calls non-blocking splice() before mptcp_worker() runs while msk->backlog_list is empty, mptcp_recv_skb() skips mptcp_move_skbs(), so SOCK_DONE and RCV_SHUTDOWN remain unset and mptcp_splice_read() returns -EAGAIN instead of 0. Processing a pending DATA_FIN synchronously in mptcp_splice_read() would close this window. > @@ -2544,6 +2552,12 @@ static int mptcp_recvmsg(struct sock *sk, struct m= sghdr *msg, size_t len, > if (!list_empty(&msk->backlog_list) && mptcp_move_skbs(sk)) > continue; > =20 > + /* The RX path may have queued the data directly and left > + * the DATA_FIN for the worker to process. > + */ > + if (unlikely(READ_ONCE(msk->rcv_data_fin))) > + mptcp_check_data_fin(sk); > + > /* only the MPTCP socket status is relevant here. The exit > * conditions mirror closely tcp_recvmsg() > */ [Severity: Medium] Can calling mptcp_check_data_fin() unconditionally here cause mptcp_recvmsg() to return 0 instead of -ECONNRESET on a fallback socket reset? CPU0 CPU1 () mptcp_recvmsg() lock_sock(sk) tcp_reset(ssk) tcp_done_with_error(ssk, ECONNRESET) subflow_state_change(ssk) subflow_sched_work_if_closed() msk->rcv_data_fin =3D 1 subflow_error_report(ssk) set MPTCP_ERROR_REPORT in cb_fla= gs mptcp_check_data_fin(sk) sk->sk_shutdown |=3D RCV_SHUTDOWN sock_error(sk) =3D=3D 0 if (sk->sk_shutdown & RCV_SHUTDOWN) break; <-- returns 0 (EOF) release_sock(sk) __mptcp_error_report(sk) On a fallback connection with an empty receive queue, a concurrent RST sets msk->rcv_data_fin via subflow_sched_work_if_closed() without setting SOCK_DONE on msk->first. Because lock_sock(sk) is held, subflow_error_report() defers sk->sk_err until release_sock(sk). mptcp_check_data_fin() still sets RCV_SHUTDOWN when mptcp_check_fin_eof() is false, so mptcp_recvmsg() sees sock_error(sk) =3D=3D 0 and returns 0 instead of -ECONNRESET. Gating this call on mptcp_pending_eof(sk, NULL) would avoid consuming a RST-emulated DATA_FIN before error propagation. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/30e3f1d6eabedf2cc62= dbb742d48983187c90ffd.1796518897.git.tanggeliang@kylinos.cn?part=3D1