diff options
author | Sasha Levin <sasha.levin@oracle.com> | 2016-02-19 13:53:10 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-02-19 14:37:43 -0500 |
commit | 6bbd9a05a1f9839873a9290b5b7c6fafde8447ba (patch) | |
tree | 4f83f561ca91b3c20d191b71be112dda636b0e5e /kernel/bpf/hashtab.c | |
parent | dfa2eb8634bc3893756057c76ea46b94fb1049f1 (diff) |
bpf: grab rcu read lock for bpf_percpu_hash_update
bpf_percpu_hash_update() expects rcu lock to be held and warns if it's not,
which pointed out a missing rcu read lock.
Fixes: 15a07b338 ("bpf: add lookup/update support for per-cpu hash and array maps")
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/bpf/hashtab.c')
-rw-r--r-- | kernel/bpf/hashtab.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index fd5db8fe9360..a68e95133fcd 100644 --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c @@ -619,7 +619,13 @@ out: int bpf_percpu_hash_update(struct bpf_map *map, void *key, void *value, u64 map_flags) { - return __htab_percpu_map_update_elem(map, key, value, map_flags, true); + int ret; + + rcu_read_lock(); + ret = __htab_percpu_map_update_elem(map, key, value, map_flags, true); + rcu_read_unlock(); + + return ret; } static const struct bpf_map_ops htab_percpu_ops = { |