CVE-2026-143210: net: skbuff: uncharge trimmed zerocopy frags on error
In the Linux kernel, the following vulnerability has been resolved:
net: skbuff: uncharge trimmed zerocopy frags on error
zerocopysgfromiter() accounts for the frags that it adds even when it returns an error: it adds the growth of skb->truesize to skwmemqueued and, unless the skb is pure zerocopy, charges it to the socket.
On error, skbzerocopyiterstream() 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 tcpmem, 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.
[willemb: revised commit message]
Affected Software
Event History
Frequently Asked Questions
What conditions are required for the accounting to build up?
The condition requires repeated failed sends to the same skb. The affected path adds zerocopy fragments and their memory accounting before returning an error, then trims the fragments without undoing the associated accounting.
What is the practical impact of repeated failures?
Stale accounting can accumulate and inflate TCP memory accounting beyond tcp_mem. It can also cause skb->truesize to wrap, which can lead to a use-after-free of the socket.
Does the cleanup always succeed after an error?
The trim operation can fail only if the skb is cloned. This is not expected for an unsent skb at the tail of the TCP write queue; if trimming fails, the fragments and their accounting remain.
What does the resolved change correct?
After trimming newly added fragments following an error, the fix undoes the corresponding skb->truesize and socket memory accounting. This prevents failed sends from retaining stale zerocopy-fragment charges.