CVE-2022-50838 net: stream: purge sk_error_queue in sk_stream_kill_queues()

Not scored Published Updated

A local attacker can exhaust kernel memory and freeze the host by leaking TCP sockets via specific socket options and MSG_ZEROCOPY usage.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-50838?

CVE-2022-50838 is a denial of service vulnerability in Linux, published on 30 Dec 2025. Any signed-in user can exploit it over the network, with no action from the victim.

Official 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.

Which versions are affected by CVE-2022-50838?

How do I fix CVE-2022-50838?

Apply the vendor's patch.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2022-50838 being exploited?

There is no known exploitation of CVE-2022-50838 in the wild and no public exploit code.

Sources

Also known as DEBIAN-CVE-2022-50838, GHSA-rgwv-j5f3-fh36, UBUNTU-CVE-2022-50838.

Is CVE-2022-50838 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free