CVE-2022-50838
Unknown Unknown - Not Provided
TCP Socket Leak in Linux Kernel Causes Memory Exhaustion

Publication date: 2025-12-30

Last updated on: 2025-12-30

Assigner: kernel.org

Description
In the Linux kernel, the following vulnerability has been resolved: net: stream: purge sk_error_queue in sk_stream_kill_queues() Changheon Lee reported TCP socket leaks, with a nice repro. It seems we leak TCP sockets with the following sequence: 1) SOF_TIMESTAMPING_TX_ACK is enabled on the socket. Each ACK will cook an skb put in error queue, from __skb_tstamp_tx(). __skb_tstamp_tx() is using skb_clone(), unless SOF_TIMESTAMPING_OPT_TSONLY was also requested. 2) If the application is also using MSG_ZEROCOPY, then we put in the error queue cloned skbs that had a struct ubuf_info attached to them. Whenever an struct ubuf_info is allocated, sock_zerocopy_alloc() does a sock_hold(). As long as the cloned skbs are still in sk_error_queue, socket refcount is kept elevated. 3) Application closes the socket, while error queue is not empty. Since tcp_close() no longer purges the socket error queue, we might end up with a TCP socket with at least one skb in error queue keeping the socket alive forever. This bug can be (ab)used to consume all kernel memory and freeze the host. We need to purge the error queue, with proper synchronization against concurrent writers.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2025-12-30
Last Modified
2025-12-30
Generated
2026-05-07
AI Q&A
2025-12-30
EPSS Evaluated
2026-05-05
NVD
EUVD
Affected Vendors & Products
Showing 1 associated CPE
Vendor Product Version / Range
linux linux_kernel *
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-UNKNOWN
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

This vulnerability involves a TCP socket leak in the Linux kernel. When certain socket options are enabled (SOF_TIMESTAMPING_TX_ACK and MSG_ZEROCOPY), cloned socket buffers (skbs) with attached information are placed in the socket's error queue. If the application closes the socket while the error queue is not empty, the socket's reference count remains elevated because the error queue is not purged. This causes the TCP socket to remain alive indefinitely, leading to resource leaks.


How can this vulnerability impact me? :

This vulnerability can be exploited to consume all kernel memory by leaking TCP sockets that are never properly closed. This can eventually freeze the host system due to resource exhaustion.


What immediate steps should I take to mitigate this vulnerability?

The immediate step to mitigate this vulnerability is to apply the patch or update that purges the socket error queue properly in the Linux kernel, ensuring that tcp_close() purges the error queue with proper synchronization against concurrent writers. Until the patch is applied, avoid using the combination of SOF_TIMESTAMPING_TX_ACK with MSG_ZEROCOPY on TCP sockets, as this sequence leads to socket leaks and potential kernel memory exhaustion.


Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart