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, 7 insertions, 1 deletions
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index e42f8789b7ea..6502115e8f55 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -206,10 +206,16 @@ BPF_CALL_2(bpf_get_local_storage, struct bpf_map *, map, u64, flags)
206 */ 206 */
207 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; 208 struct bpf_cgroup_storage *storage;
209 void *ptr;
209 210
210 storage = this_cpu_read(bpf_cgroup_storage[stype]); 211 storage = this_cpu_read(bpf_cgroup_storage[stype]);
211 212
212 return (unsigned long)&READ_ONCE(storage->buf)->data[0]; 213 if (stype == BPF_CGROUP_STORAGE_SHARED)
214 ptr = &READ_ONCE(storage->buf)->data[0];
215 else
216 ptr = this_cpu_ptr(storage->percpu_buf);
217
218 return (unsigned long)ptr;
213} 219}
214 220
215const struct bpf_func_proto bpf_get_local_storage_proto = { 221const struct bpf_func_proto bpf_get_local_storage_proto = {