Skip to contentSkip to conversation

CVE-2023-54033: bpf: fix a memory leak in the LRU and LRU_PERCPU hash maps

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Dec 24, 2025

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

bpf: fix a memory leak in the LRU and LRU_PERCPU hash maps

The LRU and LRU_PERCPU maps allocate a new element on update before locking the target hash table bucket. Right after that the maps try to lock the bucket. If this fails, then maps return -EBUSY to the caller without releasing the allocated element. This makes the element untracked: it doesn't belong to either of free lists, and it doesn't belong to the hash table, so can't be re-used; this eventually leads to the permanent -ENOMEM on LRU map updates, which is unexpected. Fix this by returning the element to the local free list if bucket locking fails.

The Linux kernel CVE team has assigned CVE-2023-54033 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.11 with commit 20b6cc34ea74b6a84599c1f8a70f3315b56a1883 and fixed in 5.15.115 with commit 79ea1a12fb9a8275b6e19d4ca625dd872dedcbb9
	Issue introduced in 5.11 with commit 20b6cc34ea74b6a84599c1f8a70f3315b56a1883 and fixed in 6.1.31 with commit 1a9e80f757bbb1562d82e350afce2bb2f712cc3d
	Issue introduced in 5.11 with commit 20b6cc34ea74b6a84599c1f8a70f3315b56a1883 and fixed in 6.3.5 with commit 965e9cccbe6b9c7b379908cebcb5e3a47f20dd5e
	Issue introduced in 5.11 with commit 20b6cc34ea74b6a84599c1f8a70f3315b56a1883 and fixed in 6.4 with commit b34ffb0c6d23583830f9327864b9c1f486003305

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2023-54033

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
kernel/bpf/hashtab.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/79ea1a12fb9a8275b6e19d4ca625dd872dedcbb9
	https://git.kernel.org/stable/c/1a9e80f757bbb1562d82e350afce2bb2f712cc3d
	https://git.kernel.org/stable/c/965e9cccbe6b9c7b379908cebcb5e3a47f20dd5e
	https://git.kernel.org/stable/c/b34ffb0c6d23583830f9327864b9c1f486003305