From: Andrew Stellman <bugs@stellman-greene.com>
To: David Howells <dhowells@redhat.com>,
Marc Dionne <marc.dionne@auristor.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
linux-afs@lists.infradead.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH net v2] rxrpc: Fix max_data reduction on an oversized ICMPv6 PTB
Date: Thu, 3 Dec 2026 16:50:29 -0500 [thread overview]
Message-ID: <20261203215029.26096-1-bugs@stellman-greene.com> (raw)
From: Andrew Stellman <astellman@stellman-greene.com>
rxrpc_adjust_mtu() computes max_data with max_t(int, mtu - peer->hdrsize,
500), so an oversized MTU in an ICMPv6 PTB makes mtu - peer->hdrsize
negative and reduces max_data to 500. Comparing as unsigned exposes a
second wrap: when the ICMP gives no MTU and if_mtu is below 100,
mtu -= 100 wraps and the 500-byte floor is skipped. Compare as unsigned
and check the estimate before subtracting 100.
The issue was found by Claude Opus 5.5 running Quality Playbook, an
LLM-driven code review tool:
https://github.com/andrewstellman/quality-playbook
The fix was drafted with OpenAI GPT-6 (Codex), this changelog with
OpenAI GPT-6 (Codex) and Claude Opus 5.5, and both were reviewed by me.
Fixes: eeaedc5449d9 ("rxrpc: Implement path-MTU probing using padded PING ACKs (RFC8899)")
Signed-off-by: Andrew Stellman <astellman@stellman-greene.com>
---
v1: https://lore.kernel.org/netdev/20261202181319.74045-1-bugs@stellman-greene.com/
v2: Also guard the MTU estimate when the ICMP gives no MTU, as
Sashiko's review of v1 pointed out.
Tested on net 90ae4042bd9f in arm64 QEMU with KASAN: an oversized PTB
changed max_data from 1440 to 500 on base and left it at 1440 on v2;
with a test-only if_mtu=80 hook, a zero-MTU PTB left it at 1440 on v1
and reduced it to 500 on v2.
A reproducer is available on request.
net/rxrpc/peer_event.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/net/rxrpc/peer_event.c b/net/rxrpc/peer_event.c
index 9d02448ac062..3b1ee4f6aa5a 100644
--- a/net/rxrpc/peer_event.c
+++ b/net/rxrpc/peer_event.c
@@ -116,13 +116,17 @@ static void rxrpc_adjust_mtu(struct rxrpc_peer *peer, unsigned int mtu)
if (mtu < 1500)
mtu = 1500;
} else {
- mtu -= 100;
- if (mtu < peer->hdrsize)
+ if (mtu < peer->hdrsize + 100)
mtu = peer->hdrsize + 4;
+ else
+ mtu -= 100;
}
}
- 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) {
if (peer->pmtud_good > max_data)
peer->pmtud_good = max_data;
--
2.53.0
reply other threads:[~2026-12-03 21:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261203215029.26096-1-bugs@stellman-greene.com \
--to=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