From: Martin KaFai Lau Both replace_effective_prog() and purge_effective_progs() test the "!prog_list_prog(pl)" to skip a 'detaching' pl. When detaching a pl, pl->prog and pl->link are set to NULL in case the update_effective_progs() failed. However, replace_effective_prog() is not detaching a pl, so the case "!prog_list_prog()" will not happen. In purge_effective_prog(), the pl->prog and pl->link are restored before calling purge_effective_progs(), so the case "!prog_list_prog()" will not happen either. This patch removes them as a prep work for the upcoming work in attaching struct_ops to cgroup. When attaching a struct_ops to cgroup, there is a link->map case and the prog_list_prog() will not consider the link->map. The replace_effective_prog() and purge_effective_progs() will then incorrectly skip a pl with struct_ops map attached to it. Signed-off-by: Martin KaFai Lau --- kernel/bpf/cgroup.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c index 876f6a81a9b6..71591f6dc458 100644 --- a/kernel/bpf/cgroup.c +++ b/kernel/bpf/cgroup.c @@ -946,8 +946,6 @@ static void replace_effective_prog(struct cgroup *cgrp, head = &cg->bpf.progs[atype]; hlist_for_each_entry(pl, head, node) { - if (!prog_list_prog(pl)) - continue; if (pl->link == link) goto found; pos++; @@ -1099,8 +1097,6 @@ static void purge_effective_progs(struct cgroup *cgrp, struct bpf_prog *prog, head = &cg->bpf.progs[atype]; hlist_for_each_entry(pl, head, node) { - if (!prog_list_prog(pl)) - continue; if (pl->prog == prog && pl->link == link) goto found; pos++; -- 2.53.0-Meta