CVE Database›Document archive›CVE-2022-50838

CVE-2022-50838

kernel: net: stream: purge sk_error_queue in sk_stream_kill_queues()

Loading…

Severity

Moderate

Red Hat Product Security

6.2

CVSS 3.1

Review impact separately from score.

Published · December 30, 2025

Updated · July 8, 2026

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.

Statement

A flaw in the Linux networking stack could leak TCP sockets when TX ACK timestamping and MSG_ZEROCOPY are used and the application closes the socket while sk_error_queue still holds cloned skb objects that keep an extra socket reference. This can be abused by a local unprivileged process to accumulate unreleased kernel objects and potentially exhaust kernel memory, leading to a host-level denial of service.

CVSS score applicability

The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.

Mitigation

No mitigation is specified in collected source.

CVSS / CWE

CVSS 3.1 · 6.2
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

CWE-401 · Missing Release of Memory after Effective Lifetime