diff options
author | Anton Protopopov <aspsk@isovalent.com> | 2023-05-22 17:45:58 +0200 |
---|---|---|
committer | Martin KaFai Lau <martin.lau@kernel.org> | 2023-05-22 19:26:39 +0200 |
commit | b34ffb0c6d23583830f9327864b9c1f486003305 (patch) | |
tree | c628f2bc7f4f6c1a0399fdb94ec897357b41444a /.get_maintainer.ignore | |
parent | bpf: Fix mask generation for 32-bit narrow loads of 64-bit fields (diff) | |
download | linux-b34ffb0c6d23583830f9327864b9c1f486003305.tar.xz linux-b34ffb0c6d23583830f9327864b9c1f486003305.zip |
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.
Fixes: 20b6cc34ea74 ("bpf: Avoid hashtab deadlock with map_locked")
Signed-off-by: Anton Protopopov <aspsk@isovalent.com>
Link: https://lore.kernel.org/r/20230522154558.2166815-1-aspsk@isovalent.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to '.get_maintainer.ignore')
0 files changed, 0 insertions, 0 deletions