Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1338410 > unrolled thread
| Started by | Sasha Levin <sasha.levin@oracle.com> |
|---|---|
| First post | 2016-02-19 20:00 +0100 |
| Last post | 2016-02-19 20:50 +0100 |
| Articles | 4 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH v2] bpf: grab rcu read lock for bpf_percpu_hash_update Sasha Levin <sasha.levin@oracle.com> - 2016-02-19 20:00 +0100
Re: [PATCH v2] bpf: grab rcu read lock for bpf_percpu_hash_update Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2016-02-19 20:00 +0100
Re: [PATCH v2] bpf: grab rcu read lock for bpf_percpu_hash_update Daniel Borkmann <daniel@iogearbox.net> - 2016-02-19 20:10 +0100
Re: [PATCH v2] bpf: grab rcu read lock for bpf_percpu_hash_update David Miller <davem@davemloft.net> - 2016-02-19 20:50 +0100
| From | Sasha Levin <sasha.levin@oracle.com> |
|---|---|
| Date | 2016-02-19 20:00 +0100 |
| Subject | [PATCH v2] bpf: grab rcu read lock for bpf_percpu_hash_update |
| Message-ID | <r3Yrw-1eR-3@gated-at.bofh.it> |
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>
---
kernel/bpf/hashtab.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
index fd5db8f..a68e951 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 = {
--
1.7.10.4
[toc] | [next] | [standalone]
| From | Alexei Starovoitov <alexei.starovoitov@gmail.com> |
|---|---|
| Date | 2016-02-19 20:00 +0100 |
| Message-ID | <r3Yrw-1eR-11@gated-at.bofh.it> |
| In reply to | #1338410 |
On Fri, Feb 19, 2016 at 01:53:10PM -0500, Sasha Levin wrote:
> 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>
thank you.
Acked-by: Alexei Starovoitov <ast@kernel.org>
[toc] | [prev] | [next] | [standalone]
| From | Daniel Borkmann <daniel@iogearbox.net> |
|---|---|
| Date | 2016-02-19 20:10 +0100 |
| Message-ID | <r3YBc-1Bp-5@gated-at.bofh.it> |
| In reply to | #1338410 |
On 02/19/2016 07:53 PM, Sasha Levin wrote:
> 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>
LGTM, patch is against net-next tree.
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2016-02-19 20:50 +0100 |
| Message-ID | <r3ZdT-1QS-7@gated-at.bofh.it> |
| In reply to | #1338410 |
From: Sasha Levin <sasha.levin@oracle.com>
Date: Fri, 19 Feb 2016 13:53:10 -0500
> 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>
Applied, thanks.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web