summaryrefslogtreecommitdiff
path: root/kernel/bpf/bpf_inode_storage.c
diff options
context:
space:
mode:
authorKP Singh <kpsingh@kernel.org>2022-04-18 18:51:58 +0300
committerAlexei Starovoitov <ast@kernel.org>2022-04-20 03:55:45 +0300
commitdcf456c9a095a6e71f53d6f6f004133ee851ee70 (patch)
tree9050bc91c5fb6751e8ab4a6076837645ef34dd19 /kernel/bpf/bpf_inode_storage.c
parent0e5aefa334dba7fc07ee4ef52ae622f957fc865b (diff)
downloadlinux-dcf456c9a095a6e71f53d6f6f004133ee851ee70.tar.xz
bpf: Fix usage of trace RCU in local storage.
bpf_{sk,task,inode}_storage_free() do not need to use call_rcu_tasks_trace as no BPF program should be accessing the owner as it's being destroyed. The only other reader at this point is bpf_local_storage_map_free() which uses normal RCU. The only path that needs trace RCU are: * bpf_local_storage_{delete,update} helpers * map_{delete,update}_elem() syscalls Fixes: 0fe4b381a59e ("bpf: Allow bpf_local_storage to be used by sleepable programs") Signed-off-by: KP Singh <kpsingh@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Martin KaFai Lau <kafai@fb.com> Link: https://lore.kernel.org/bpf/20220418155158.2865678-1-kpsingh@kernel.org
Diffstat (limited to 'kernel/bpf/bpf_inode_storage.c')
-rw-r--r--kernel/bpf/bpf_inode_storage.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/bpf/bpf_inode_storage.c b/kernel/bpf/bpf_inode_storage.c
index 96be8d518885..10424a1cda51 100644
--- a/kernel/bpf/bpf_inode_storage.c
+++ b/kernel/bpf/bpf_inode_storage.c
@@ -90,7 +90,7 @@ void bpf_inode_storage_free(struct inode *inode)
*/
bpf_selem_unlink_map(selem);
free_inode_storage = bpf_selem_unlink_storage_nolock(
- local_storage, selem, false);
+ local_storage, selem, false, false);
}
raw_spin_unlock_bh(&local_storage->lock);
rcu_read_unlock();
@@ -149,7 +149,7 @@ static int inode_storage_delete(struct inode *inode, struct bpf_map *map)
if (!sdata)
return -ENOENT;
- bpf_selem_unlink(SELEM(sdata));
+ bpf_selem_unlink(SELEM(sdata), true);
return 0;
}