Netdev List
 help / color / mirror / Atom feed
* [PATCH net v2] rxrpc: Fix max_data reduction on an oversized ICMPv6 PTB
@ 2026-12-03 21:50 Andrew Stellman
  0 siblings, 0 replies; only message in thread
From: Andrew Stellman @ 2026-12-03 21:50 UTC (permalink / raw)
  To: David Howells, Marc Dionne
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, linux-afs, netdev, linux-kernel

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-03 21:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 21:50 [PATCH net v2] rxrpc: Fix max_data reduction on an oversized ICMPv6 PTB Andrew Stellman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox