Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: bugs@stellman-greene.com
Cc: dhowells@redhat.com, marc.dionne@auristor.com,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org,
	linux-afs@lists.infradead.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] rxrpc: Fix max_data reduction on an oversized ICMPv6 PTB
Date: Thu, 03 Dec 2026 18:14:50 +0000	[thread overview]
Message-ID: <179632169057.3146.9146296329897955249@kernel.org> (raw)
In-Reply-To: <20261202181319.74045-1-bugs@stellman-greene.com>

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

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

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] rxrpc_adjust_mtu() in net/rxrpc/peer_event.c: when the ICMP
  carries no MTU (mtu == 0), the function estimates one with `mtu =…
- [Low] The note that the bug was found with an AI-driven tool (Quality
  Playbook running Claude) and that the fix was drafted with an AI…

--

rxrpc: Fix max_data reduction on an oversized ICMPv6 PTB

This patch changes the max_data calculation in rxrpc_adjust_mtu(). The
old code was max_t(int, mtu - peer->hdrsize, 500). The new code is an
explicit unsigned comparison against hdrsize followed by max(..., 500U).
With this, an oversized ICMPv6 Packet Too Big no longer floors max_data
to 500.

> Fixes: eeaedc5449d9 ("rxrpc: Implement path-MTU probing using padded PING ACKs (RFC8899)")
> Signed-off-by: Andrew Stellman <astellman@stellman-greene.com>
>
> ---
[ ... ]
> Found with Quality Playbook
> (https://github.com/andrewstellman/quality-playbook) running Claude
> Opus 5.5; the fix was drafted with OpenAI GPT-6 (Codex).

[Severity: Low]
This isn't a bug, but the tool disclosure is below the --- separator, so
git am drops it. The applied commit message ends at the Signed-off-by
line.

Documentation/process/generated-content.rst says:

    if a tool was used to find a problem addressed by
    a change, that should be noted in the changelog.

Could the note that the bug was found and the fix drafted with these
tools be moved into the commit message body?

> diff --git a/net/rxrpc/peer_event.c b/net/rxrpc/peer_event.c
> index 9d02448ac062c..5e9cd4adc478e 100644
> --- a/net/rxrpc/peer_event.c
> +++ b/net/rxrpc/peer_event.c
> @@ -122,7 +122,10 @@ static void rxrpc_adjust_mtu(struct rxrpc_peer *peer, unsigned int mtu)
>  		}
>  	}
>
> -	max_data = max_t(int, mtu - peer->hdrsize, 500);
> +	if (mtu <= peer->hdrsize)
> +		max_data = 500;
> +	else
> +		max_data = max(mtu - peer->hdrsize, 500U);
>  	if (max_data < peer->max_data) {

[Severity: Medium]
Does this change lose the 500 floor when the estimated MTU wraps in the
mtu == 0 path? Earlier in rxrpc_adjust_mtu():

	if (mtu == 0) {
		/* they didn't give us a size, estimate one */
		mtu = peer->if_mtu;
		if (mtu > 1500) {
			...
		} else {
			mtu -= 100;
			if (mtu < peer->hdrsize)
				mtu = peer->hdrsize + 4;
		}
	}

If peer->if_mtu is below 100, mtu -= 100 wraps to about 0xffffffxx. The
unsigned mtu < peer->hdrsize check can't catch that.

Before this patch, max_t(int, mtu - peer->hdrsize, 500) read the wrapped
difference as negative and gave 500.

With the new code, mtu <= peer->hdrsize is false, and
max(mtu - peer->hdrsize, 500U) gives roughly 0xffffff7e. That makes
max_data < peer->max_data false, so the reduction is skipped. So are
the pmtud_good/pmtud_bad clamps and trace_rxrpc_pmtud_reduce().

There are two ways if_mtu can end up below 100.

First, when peer->if_mtu == 65535, an ICMP FRAG_NEEDED or ICMPv6 PTB with
0 < mtu < 100 sets if_mtu to that value at the top of rxrpc_adjust_mtu().
If max_data was already 500 or less at that point (for example after an
ACK trailer advertised maxMTU 500), pmtud_good and pmtud_bad are not
clamped. rxrpc_input_probe_for_pmtud() can then raise max_data above 500
again.

Second, rxrpc_assess_MTU_size() does:

	peer->if_mtu = dst_mtu(dst);
	peer->hdrsize += dst->header_len + dst->trailer_len;

A small route MTU or xfrm overhead can leave if_mtu below hdrsize, with
max_data = RXRPC_JUMBO(1).

In either state, a later zero-MTU ICMP that reaches the function via
rxrpc_encap_err_rcv()->rxrpc_input_error()->rxrpc_adjust_mtu(peer, 0)
used to cut max_data to 500. Now it has no effect.

The commit message says "keep the 500 floor for MTUs at or below the
header size". Does that still hold when the estimate goes below zero?

Would guarding the subtraction keep the intended floor? Something like:

	if (mtu < peer->hdrsize + 100)
		mtu = peer->hdrsize + 4;
	else
		mtu -= 100;

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202181319.74045-1-bugs%40stellman-greene.com

      reply	other threads:[~2026-12-03 18:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 18:13 [PATCH net] rxrpc: Fix max_data reduction on an oversized ICMPv6 PTB Andrew Stellman
2026-12-03 18:14 ` netdev-bot+sashiko [this message]

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=179632169057.3146.9146296329897955249@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=bugs@stellman-greene.com \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.dionne@auristor.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox