bpf: cgroup_iter: support cgroup1 using cgroup fd
authorYosry Ahmed <yosryahmed@google.com>
Tue, 11 Oct 2022 00:33:59 +0000 (00:33 +0000)
committerTejun Heo <tj@kernel.org>
Tue, 11 Oct 2022 16:50:15 +0000 (06:50 -1000)
Use cgroup_v1v2_get_from_fd() in cgroup_iter to support attaching to
both cgroup v1 and v2 using fds.

Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Acked-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/bpf/cgroup_iter.c

index 0d200a993489cb72545cf325d565685f58e3d54b..9fcf09f2ef00f3dea4003923260e2fcc7a2cdcce 100644 (file)
@@ -196,7 +196,7 @@ static int bpf_iter_attach_cgroup(struct bpf_prog *prog,
                return -EINVAL;
 
        if (fd)
-               cgrp = cgroup_get_from_fd(fd);
+               cgrp = cgroup_v1v2_get_from_fd(fd);
        else if (id)
                cgrp = cgroup_get_from_id(id);
        else /* walk the entire hierarchy by default. */