]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
bpf: Mutex protect used_maps array and count
authorYiFei Zhu <zhuyifei@google.com>
Tue, 15 Sep 2020 23:45:39 +0000 (16:45 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 16 Sep 2020 01:28:27 +0000 (18:28 -0700)
commit984fe94f94756dacb3c8cc52904a23adf9e04da1
tree70c58720e1166b35434d2033abcdda63e915f6d3
parentd317b0a8acfc4b126858e4cdadb03338d22f8ce0
bpf: Mutex protect used_maps array and count

To support modifying the used_maps array, we use a mutex to protect
the use of the counter and the array. The mutex is initialized right
after the prog aux is allocated, and destroyed right before prog
aux is freed. This way we guarantee it's initialized for both cBPF
and eBPF.

Signed-off-by: YiFei Zhu <zhuyifei@google.com>
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Cc: YiFei Zhu <zhuyifei1999@gmail.com>
Link: https://lore.kernel.org/bpf/20200915234543.3220146-2-sdf@google.com
drivers/net/ethernet/netronome/nfp/bpf/offload.c
include/linux/bpf.h
kernel/bpf/core.c
kernel/bpf/syscall.c
net/core/dev.c