aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/bpf/helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/bpf/helpers.c')
-rw-r--r--kernel/bpf/helpers.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index 9070b2ace6aa..e42f8789b7ea 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -195,7 +195,8 @@ const struct bpf_func_proto bpf_get_current_cgroup_id_proto = {
195}; 195};
196 196
197#ifdef CONFIG_CGROUP_BPF 197#ifdef CONFIG_CGROUP_BPF
198DECLARE_PER_CPU(void*, bpf_cgroup_storage[MAX_BPF_CGROUP_STORAGE_TYPE]); 198DECLARE_PER_CPU(struct bpf_cgroup_storage*,
199 bpf_cgroup_storage[MAX_BPF_CGROUP_STORAGE_TYPE]);
199 200
200BPF_CALL_2(bpf_get_local_storage, struct bpf_map *, map, u64, flags) 201BPF_CALL_2(bpf_get_local_storage, struct bpf_map *, map, u64, flags)
201{ 202{
@@ -204,8 +205,11 @@ BPF_CALL_2(bpf_get_local_storage, struct bpf_map *, map, u64, flags)
204 * verifier checks that its value is correct. 205 * verifier checks that its value is correct.
205 */ 206 */
206 enum bpf_cgroup_storage_type stype = cgroup_storage_type(map); 207 enum bpf_cgroup_storage_type stype = cgroup_storage_type(map);
208 struct bpf_cgroup_storage *storage;
207 209
208 return (unsigned long) this_cpu_read(bpf_cgroup_storage[stype]); 210 storage = this_cpu_read(bpf_cgroup_storage[stype]);
211
212 return (unsigned long)&READ_ONCE(storage->buf)->data[0];
209} 213}
210 214
211const struct bpf_func_proto bpf_get_local_storage_proto = { 215const struct bpf_func_proto bpf_get_local_storage_proto = {