Home Home > GIT Browse > SLE15-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Lin <glin@suse.com>2019-02-15 17:27:57 +0800
committerGary Lin <glin@suse.com>2019-02-15 17:28:24 +0800
commit6cbc679f62356fce7b9a3de06caf8d45af6a0890 (patch)
tree3b688db6fce91fe23d1bfda9945a9a1605752795
parent3e3e8289159eb7a11d469d859f22fdd7623900e3 (diff)
bpf: Fix syscall's stackmap lookup potential deadlock
(bsc#1083647). suse-commit: d98e12d68db02c346c2aee9103ed95841d0a637c
-rw-r--r--kernel/bpf/syscall.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index f57fd8a37cbb..9a309140cfc5 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -473,6 +473,8 @@ static int map_lookup_elem(union bpf_attr *attr)
if (!value)
goto free_key;
+ 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);
@@ -492,6 +494,8 @@ static int map_lookup_elem(union bpf_attr *attr)
rcu_read_unlock();
err = ptr ? 0 : -ENOENT;
}
+ this_cpu_dec(bpf_prog_active);
+ preempt_enable();
if (err)
goto free_value;