From: Sasha Levin <sasha.levin@oracle.com>
To: ast@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
davem@davemloft.net, Sasha Levin <sasha.levin@oracle.com>
Subject: [PATCH] bpf: grab rcu read lock for bpf_percpu_hash_update
Date: Thu, 18 Feb 2016 21:56:22 -0500 [thread overview]
Message-ID: <1455850582-9490-1-git-send-email-sasha.levin@oracle.com> (raw)
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/syscall.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index c95a753..94324b8 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -348,7 +348,9 @@ static int map_update_elem(union bpf_attr *attr)
goto free_value;
if (map->map_type == BPF_MAP_TYPE_PERCPU_HASH) {
+ rcu_read_lock();
err = bpf_percpu_hash_update(map, key, value, attr->flags);
+ rcu_read_unlock();
} else if (map->map_type == BPF_MAP_TYPE_PERCPU_ARRAY) {
err = bpf_percpu_array_update(map, key, value, attr->flags);
} else {
--
1.7.10.4
next reply other threads:[~2016-02-19 2:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-19 2:56 Sasha Levin [this message]
2016-02-19 3:12 ` Alexei Starovoitov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1455850582-9490-1-git-send-email-sasha.levin@oracle.com \
--to=sasha.levin@oracle.com \
--cc=ast@kernel.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®