]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bpf: Handle in-place update for full LPM trie correctly
authorHou Tao <houtao1@huawei.com>
Fri, 6 Dec 2024 11:06:17 +0000 (19:06 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 6 Dec 2024 17:14:26 +0000 (09:14 -0800)
commit532d6b36b2bfac5514426a97a4df8d103d700d43
treef35658f3fae7f2f7450b8ce59b38f7d29e148a15
parenteae6a075e9537dd69891cf77ca5a88fa8a28b4a1
bpf: Handle in-place update for full LPM trie correctly

When a LPM trie is full, in-place updates of existing elements
incorrectly return -ENOSPC.

Fix this by deferring the check of trie->n_entries. For new insertions,
n_entries must not exceed max_entries. However, in-place updates are
allowed even when the trie is full.

Fixes: b95a5c4db09b ("bpf: add a longest prefix match trie map implementation")
Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Hou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20241206110622.1161752-5-houtao@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/lpm_trie.c