summaryrefslogtreecommitdiffstats
path: root/kernel/bpf/syscall.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-11 09:28:39 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-11 09:28:39 +0100
commit15e99b13b44bd969b085f866fb4d5dc72f65d2d0 (patch)
tree6af5d0b1c225400d2c1df9951d6b8d85b6329f8f /kernel/bpf/syscall.c
parent81534d5fa973fc10a48c245c08688e61ffe41366 (diff)
parentd13937116f1e82bf508a6325111b322c30c85eb9 (diff)
downloadlinux-stable-15e99b13b44bd969b085f866fb4d5dc72f65d2d0.tar.gz
linux-stable-15e99b13b44bd969b085f866fb4d5dc72f65d2d0.tar.bz2
linux-stable-15e99b13b44bd969b085f866fb4d5dc72f65d2d0.zip
Merge 5.0-rc6 into usb-next
We need the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/bpf/syscall.c')
-rw-r--r--kernel/bpf/syscall.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index b155cd17c1bd..8577bb7f8be6 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -713,8 +713,13 @@ static int map_lookup_elem(union bpf_attr *attr)
if (bpf_map_is_dev_bound(map)) {
err = bpf_map_offload_lookup_elem(map, key, value);
- } else if (map->map_type == BPF_MAP_TYPE_PERCPU_HASH ||
- map->map_type == BPF_MAP_TYPE_LRU_PERCPU_HASH) {
+ goto done;
+ }
+
+ preempt_disable();
+ this_cpu_inc(bpf_prog_active);
+ if (map->map_type == BPF_MAP_TYPE_PERCPU_HASH ||
+ map->map_type == BPF_MAP_TYPE_LRU_PERCPU_HASH) {
err = bpf_percpu_hash_copy(map, key, value);
} else if (map->map_type == BPF_MAP_TYPE_PERCPU_ARRAY) {
err = bpf_percpu_array_copy(map, key, value);
@@ -744,7 +749,10 @@ static int map_lookup_elem(union bpf_attr *attr)
}
rcu_read_unlock();
}
+ this_cpu_dec(bpf_prog_active);
+ preempt_enable();
+done:
if (err)
goto free_value;