summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorChris Mason <mason@kernel.org>2026-11-05 17:35:06 -0500
committerJakub Kicinski <kuba@kernel.org>2026-11-10 15:20:13 -0800
commit8b67debdfbf6b370312ebec5c9e0a1c39b5c7733 (patch)
treeb638e9fc9ca4d57ba14aa50e89ad65da1c3f26e3 /tools/perf/scripts/python
parent6a01fb125ba6474cb97f14b68fe5435d3cdd08e5 (diff)
net: skbuff: uncharge trimmed zerocopy frags on error
__zerocopy_sg_from_iter() accounts for the frags that it adds even when it returns an error: it adds the growth of skb->truesize to sk_wmem_queued and, unless the skb is pure zerocopy, charges it to the socket. On error, skb_zerocopy_iter_stream() cannot free the skb, as it may hold data from an earlier send. It trims the new frags, but leaves skb->truesize and their accounting in place. Repeated failed sends to the same skb accumulate this stale accounting. This can inflate TCP memory accounting past tcp_mem, and can wrap skb->truesize, leading to a use-after-free of the socket. Undo the accounting after the trim. If the trim fails, the frags and their accounting remain. The trim only fails if the skb is cloned, which is not expected for the unsent skb at the TCP write queue tail. The issue was found by an LLM. Fixes: 52267790ef52 ("sock: add MSG_ZEROCOPY") Reported-by: Kyle Zeng <kylebot@openai.com> Signed-off-by: Chris Mason <mason@kernel.org> [willemb: revised commit message] Signed-off-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20261105223512.3647504-1-willemdebruijn.kernel@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions