diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c index 2bbe77de89f0..ce82963bcfc7 100644 --- a/kernel/bpf/cgroup.c +++ b/kernel/bpf/cgroup.c @@ -45,6 +45,7 @@ static enum cgroup_bpf_attach_type find_atype_by_struct_ops_id(u32 type_id) for (atype = 0; atype < MAX_CGROUP_BPF_ATTACH_TYPE; atype++) { if (cgroup_bpf_is_struct_ops_atype(atype) && + cgroup_struct_ops[atype].type_id && cgroup_struct_ops[atype].type_id == type_id) return atype; } @@ -1448,8 +1449,6 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, return -ENOENT; from_atype = to_atype = atype; flags = 0; - if (!cgroup_bpf_enabled(atype)) - goto skip_count; } else if (type == BPF_LSM_CGROUP) { if (!effective_query && attr->query.prog_cnt && prog_ids && !prog_attach_flags) @@ -1476,7 +1475,6 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, } } -skip_count: /* always output uattr->query.attach_flags as 0 during effective query */ flags = effective_query ? 0 : flags; if (copy_to_user(&uattr->query.attach_flags, &flags, sizeof(flags)))