bpf: fix a memory leak in the LRU and LRU_PERCPU hash maps
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
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.
From the CVE record · Linux
The Linux kernel's BPF LRU and LRU_PERCPU hash maps can leak an allocated element when a bucket lock attempt fails during an update. Repeated failures can exhaust reusable elements, causing subsequent LRU map updates to return -ENOMEM permanently. The input does not specify network or local access, authentication, or user-interaction requirements.
Engineers running Linux kernels with BPF LRU or LRU_PERCPU hash maps should check their kernel versions; affected versions are not specified.