summaryrefslogtreecommitdiff
path: root/net/ipv4/tcp.c
diff options
context:
space:
mode:
authorMina Almasry <almasrymina@google.com>2026-08-14 19:13:31 +0000
committerJakub Kicinski <kuba@kernel.org>2026-08-20 13:22:14 -0700
commitd9c56501c72fdac937e8b770f31655c46832f1a5 (patch)
tree7a06e4c4f13a86980d4d4e2723a2df75029b2ee8 /net/ipv4/tcp.c
parent68d8c6532659168430e489bb659c0d41de7d75fe (diff)
downloadlinux-next-d9c56501c72fdac937e8b770f31655c46832f1a5.tar.gz
linux-next-d9c56501c72fdac937e8b770f31655c46832f1a5.zip
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: bd61848900bff ("net: devmem: Implement TX path") Suggested-by: Eric Dumazet <edumazet@google.com> Cc: Pavel Begunkov <asml.silence@gmail.com> Cc: Stanislav Fomichev <sdf@fomichev.me> Cc: Bobby Eshleman <bobbyeshleman@gmail.com> Signed-off-by: Mina Almasry <almasrymina@google.com> Link: https://patch.msgid.link/20260814191336.187243-2-almasrymina@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r--net/ipv4/tcp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 455441f1b694..b4237d0e994d 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -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: