[PATCH net-next v6 3/7] tcp: fix unreadable net_iov handling in tcp_clone_payload()

From
Mina Almasry <hidden>
Date
2026-11-20 20:14:15
Reply to
Mina Almasry, 2026-11-20
tcp_clone_payload() clones fragments from the TCP write queue into an
MTU probe skb, but does not propagate skb->unreadable and compares
adjacent fragments using skb_frag_page(). On devmem TX skbs backed by
unreadable net_iovs, skb_frag_page() returns NULL for every fragment,
causing distinct net_iovs with contiguous offsets to compare equal as
NULL == NULL and be merged incorrectly, while leaving to->unreadable
clear on the resulting probe skb.

Propagate skb->unreadable to the probe skb and compare fragments via
skb_frag_netmem().

This issue is theoretical and was found by manual code inspection and
LLM review; it was not triggered in production. Verified with the
net_core KUnit test suite; not tested on real hardware.

Fixes: bd61848900bf ("net: devmem: Implement TX path")
Signed-off-by: Mina Almasry <redacted>
---
 net/ipv4/tcp_output.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 08d0d4a639fe..19059d03152e 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2696,8 +2696,10 @@ static int tcp_clone_payload(struct sock *sk, struct sk_buff *to,
 				     probe_size - len);
 			len += todo;
 			skb_shinfo(to)->flags |= skb_shinfo(skb)->flags & SKBFL_SHARED_FRAG;
+			to->unreadable |= skb->unreadable;
 			if (lastfrag &&
-			    skb_frag_page(fragfrom) == skb_frag_page(lastfrag) &&
+			    skb_frag_netmem(fragfrom) ==
+			    skb_frag_netmem(lastfrag) &&
 			    skb_frag_off(fragfrom) == skb_frag_off(lastfrag) +
 						      skb_frag_size(lastfrag)) {
 				skb_frag_size_add(lastfrag, todo);
-- 
2.56.1.750.gf70dc682cf-goog
Thread (8 messages) 8 messages, 1 author, last reply 1d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help