From: sashiko-bot@kernel.org
To: "Geliang Tang" <geliang@kernel.org>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v10 6/9] mptcp: implement peek_len for proto_ops
Date: Fri, 28 Aug 2026 04:10:12 +0000 [thread overview]
Message-ID: <20260828041012.C714C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <7b1fabcac57f36b0723d6ec1cac7b20dab1bbf86.1787888115.git.tanggeliang@kylinos.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] mptcp_inq() erroneously subtracts 1 from the available data count when the socket is locally shut down (SHUT_RD) or closed (TCP_CLOSE) without receiving a remote DATA_FIN.
--
commit ca4f6417172a744b76ad119fab38d5b6d5931a48
Author: Geliang Tang <geliang@kernel.org>
mptcp: implement peek_len for proto_ops
This commit adds mptcp_inq() to compute readable bytes at the MPTCP level
by calculating the difference between ack_seq and copied_seq. It also
wires this calculation into the .peek_len stream operations so upper layers
can accurately query the in-queue byte count.
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index fce85967b90ee..639122b7845a6 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
[ ... ]
> @@ -4797,6 +4797,39 @@ static ssize_t mptcp_splice_read(struct socket *sock, loff_t *ppos,
> return ret;
> }
>
> +static int mptcp_inq(struct sock *sk)
> +{
> + const struct mptcp_sock *msk = mptcp_sk(sk);
> + int answ;
> +
> + if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) {
> + answ = 0;
> + } else if (test_bit(MPTCP_SYNC_SEQ, &msk->cb_flags)) {
> + answ = 0;
> + } else {
> + u64 hint_val;
> +
> + hint_val = READ_ONCE(msk->ack_seq) - READ_ONCE(msk->copied_seq);
> + if (hint_val >= INT_MAX)
> + hint_val = INT_MAX;
> +
> + answ = (unsigned int)hint_val;
> +
> + /* Subtract 1, if FIN was received. Mirror tcp_inq() */
> + if (answ &&
> + (sk->sk_state == TCP_CLOSE ||
> + (sk->sk_shutdown & RCV_SHUTDOWN)))
> + answ--;
[Severity: High]
Does this logic correctly handle local shutdowns or connections reset via RST?
If an MPTCP socket has 1 byte of unread data and a local application calls
shutdown(fd, SHUT_RD), it sets RCV_SHUTDOWN without incrementing ack_seq
because no remote DATA_FIN was received.
Since this subtracts 1 from the answer, it would return 0. Could this cause
kernel consumers of .peek_len() (like KTLS/BPF strparser) to falsely assume
no data is available and hang indefinitely waiting for data that will never
arrive on the shut down socket?
> + }
> +
> + return answ;
> +}
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1787888115.git.tanggeliang@kylinos.cn?part=6
next prev parent reply other threads:[~2026-08-28 4:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 3:49 [PATCH mptcp-next v10 0/9] Reduce the differences between TCP and MPTCP for TLS usage Geliang Tang
2026-08-28 3:49 ` [PATCH mptcp-next v10 1/9] mptcp: drop the mptcp_ooo_try_coalesce() helper Geliang Tang
2026-08-28 3:49 ` [PATCH mptcp-next v10 2/9] mptcp: drop the cant_coalesce CB field Geliang Tang
2026-08-28 4:18 ` sashiko-bot
2026-08-28 3:49 ` [PATCH mptcp-next v10 3/9] mptcp: remove CB offset field Geliang Tang
2026-08-28 3:49 ` [PATCH mptcp-next v10 4/9] mptcp: sync mptcp skb cb layout with tcp one Geliang Tang
2026-08-28 3:49 ` [PATCH mptcp-next v10 5/9] mptcp: defer read_sock cleanup to mptcp_worker Geliang Tang
2026-08-28 3:49 ` [PATCH mptcp-next v10 6/9] mptcp: implement peek_len for proto_ops Geliang Tang
2026-08-28 4:10 ` sashiko-bot [this message]
2026-08-28 3:49 ` [PATCH mptcp-next v10 7/9] mptcp: add sendmsg_locked to proto_ops Geliang Tang
2026-08-28 3:49 ` [PATCH mptcp-next v10 8/9] mptcp: track app-limited state in mptcp_sendmsg Geliang Tang
2026-08-28 3:49 ` [PATCH mptcp-next v10 9/9] selftests: mptcp: sockopt: check app_limited Geliang Tang
2026-08-28 5:02 ` [PATCH mptcp-next v10 0/9] Reduce the differences between TCP and MPTCP for TLS usage MPTCP CI
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260828041012.C714C1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=geliang@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.