mirror of
https://github.com/torvalds/linux.git
synced 2026-05-01 21:12:29 -04:00
bpf: Make bpf_cgroup_acquire() KF_RCU | KF_RET_NULL
struct cgroup is already an RCU-safe type in the verifier. We can therefore update bpf_cgroup_acquire() to be KF_RCU | KF_RET_NULL, and subsequently remove bpf_cgroup_kptr_get(). This patch does the first of these by updating bpf_cgroup_acquire() to be KF_RCU | KF_RET_NULL, and also updates selftests accordingly. Signed-off-by: David Vernet <void@manifault.com> Link: https://lore.kernel.org/r/20230411041633.179404-1-void@manifault.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
committed by
Alexei Starovoitov
parent
10fd5f70c3
commit
1d71283987
@@ -61,6 +61,11 @@ static inline int cgrps_kfunc_map_insert(struct cgroup *cgrp)
|
||||
}
|
||||
|
||||
acquired = bpf_cgroup_acquire(cgrp);
|
||||
if (!acquired) {
|
||||
bpf_map_delete_elem(&__cgrps_kfunc_map, &id);
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
old = bpf_kptr_xchg(&v->cgrp, acquired);
|
||||
if (old) {
|
||||
bpf_cgroup_release(old);
|
||||
|
||||
Reference in New Issue
Block a user