Re: [PATCH bpf-next v6 1/2] bpf: Free special fields when update [lru_,]percpu_hash maps

From: Yonghong Song

Date: Thu Nov 06 2025 - 20:56:16 EST




On 11/5/25 7:14 AM, Leon Hwang wrote:
As [lru_,]percpu_hash maps support BPF_KPTR_{REF,PERCPU}, missing
calls to 'bpf_obj_free_fields()' in 'pcpu_copy_value()' could cause the
memory referenced by BPF_KPTR_{REF,PERCPU} fields to be held until the
map gets freed.

Fix this by calling 'bpf_obj_free_fields()' after
'copy_map_value[,_long]()' in 'pcpu_copy_value()'.

Fixes: 65334e64a493 ("bpf: Support kptrs in percpu hashmap and percpu LRU hashmap")
Signed-off-by: Leon Hwang <leon.hwang@xxxxxxxxx>

Acked-by: Yonghong Song <yonghong.song@xxxxxxxxx>