net: tcp: block mixing readable and unreadable frags

Protect tcp_sendmsg_locked() from mistakenly mixing readable and
unreadable page fragments in the same SKB.

Check that the devmem binding matches the existing SKB's readability.
If a mismatch is detected, avoid collapsing and create a new segment.

Fixes: bd61848900 ("net: devmem: Implement TX path")
Suggested-by: Eric Dumazet <[email protected]>
Cc: Pavel Begunkov <[email protected]>
Cc: Stanislav Fomichev <[email protected]>
Cc: Bobby Eshleman <[email protected]>
Signed-off-by: Mina Almasry <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
This commit is contained in:
Mina Almasry authored and Jakub Kicinski committed 2026-08-20 13:22:14 -07:00
1 parent 68d8c65326
commit d9c56501c7
1 file changed
+2 -1
+2 -1
View File
@@ -1240,7 +1240,8 @@ restart:
trace_tcp_sendmsg_locked(sk, msg, skb, size_goal);
if (copy <= 0 || !tcp_skb_can_collapse_to(skb)) {
if (copy <= 0 || !tcp_skb_can_collapse_to(skb) ||
unlikely(skb_frags_readable(skb) != !binding)) {
bool first_skb;
new_segment: