All of lore.kernel.org
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: geliang@kernel.org
Cc: mptcp@lists.linux.dev, kuba@kernel.org
Subject: Re: [PATCH mptcp-net v3 4/4] mptcp: add mptcp_inq() for SIOCINQ
Date: Tue, 24 Nov 2026 15:26:36 +0000	[thread overview]
Message-ID: <179553399645.3133.8807553916762589643@kernel.org> (raw)
In-Reply-To: <bb8866b3e5b103dab9102d27d13cf1c91556f707.1795396910.git.tanggeliang@kylinos.cn>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The commit message describes one user-visible change to
  SIOCINQ/FIONREAD: N is reported instead of N+1 when N bytes are unread…

--

mptcp: add mptcp_inq() for SIOCINQ

This adds mptcp_inq(), which computes the readable bytes at the MPTCP level
using mptcp_data_avail(). SIOCINQ switches from mptcp_inq_hint() to
mptcp_inq(), so FIONREAD no longer includes the FIN byte.

> Unlike mptcp_inq_hint(), mptcp_inq() does not include the FIN byte. Switch
> SIOCINQ from mptcp_inq_hint() to mptcp_inq() so that FIONREAD reports N
> (not N+1) when N bytes are unread with DATA_FIN pending, matching TCP's
> tcp_ioctl() which subtracts the FIN byte.

[Severity: Medium]
Is this description complete? Switching mptcp_ioctl(SIOCINQ) to mptcp_inq()
in net/mptcp/protocol.c changes FIONREAD in more cases than the pending
DATA_FIN case described here.

Before this series, an empty receive queue in TCP_CLOSE or with RCV_SHUTDOWN
set hit this exit in mptcp_inq_hint():

	if (sk->sk_state == TCP_CLOSE || (sk->sk_shutdown & RCV_SHUTDOWN))
		return 1;

So FIONREAD returned 1, and mptcp_inq() now returns 0. The cases affected
are:

  - EOF after a processed DATA_FIN (mptcp_check_data_fin() sets
    RCV_SHUTDOWN)
  - a never connected socket (mptcp_ioctl() only rejects TCP_LISTEN)
  - a socket that moved to TCP_CLOSE after a reset
  - a local shutdown(SHUT_RD)

After the previous patch in this series ("mptcp: fix TFO SIOCINQ overflow
in mptcp_inq_hint"), mptcp_inq_hint() adds the extra byte based on socket
state, whether or not a FIN was received:

	if (((sk->sk_state == TCP_CLOSE || (sk->sk_shutdown & RCV_SHUTDOWN)) &&
	     !READ_ONCE(msk->rcv_fastclose)) ||
	    (READ_ONCE(msk->rcv_data_fin) && mptcp_data_fin(msk, NULL)))
		hint_val += 1;

With N bytes queued after a local shutdown(SHUT_RD), or in a TCP_CLOSE
state that is not a fastclose with no FIN received, SIOCINQ reported N+1
after that patch. This patch brings it back to N. TCP_CM_INQ still uses
mptcp_inq_hint() and keeps the +1.

Since that +1 is not limited to a received DATA_FIN, is "mptcp_inq_hint()
... include the FIN byte" accurate?

The new values match what tcp_inq() returns, so the code change itself looks
fine. This patch carries a Fixes: tag, so it is likely to be backported to
stable. Could the commit message say that FIONREAD now returns 0 instead of
1 at EOF and on unconnected sockets? Could it also say that this patch needs
to go with its parent to undo the N+1 that the parent introduced for
SIOCINQ?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1795396910.git.tanggeliang%40kylinos.cn

  reply	other threads:[~2026-11-24 15:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23  1:27 [PATCH mptcp-net v3 0/4] mptcp: fixes for SIOCINQ Geliang Tang
2026-11-23  1:27 ` [PATCH mptcp-net v3 1/4] mptcp: handle ack_seq advancing past rcv_data_fin_seq Geliang Tang
2026-11-24 15:26   ` netdev-bot+sashiko
2026-11-23  1:27 ` [PATCH mptcp-net v3 2/4] mptcp: add missing memory barriers for rcv_data_fin_seq Geliang Tang
2026-11-24 15:26   ` netdev-bot+sashiko
2026-11-23  1:27 ` [PATCH mptcp-net v3 3/4] mptcp: fix TFO SIOCINQ overflow in mptcp_inq_hint Geliang Tang
2026-11-24 15:26   ` netdev-bot+sashiko
2026-11-23  1:27 ` [PATCH mptcp-net v3 4/4] mptcp: add mptcp_inq() for SIOCINQ Geliang Tang
2026-11-24 15:26   ` netdev-bot+sashiko [this message]
2026-11-23  3:34 ` [PATCH mptcp-net v3 0/4] mptcp: fixes " 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=179553399645.3133.8807553916762589643@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=geliang@kernel.org \
    --cc=kuba@kernel.org \
    --cc=mptcp@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.