This reverts commit f3a2aebdd6fb90e444d595e46de64e822af419da. Some callers of this function depended on the fact that it only supports cgroup v2. Revert it now, and introduce a new function in a later patch that supports both cgroup v1 and v2, for callers that need to support both. Reported-by: Christian A. Ehrhardt <lk@xxxxxxx> Signed-off-by: Yosry Ahmed <yosryahmed@xxxxxxxxxx> --- kernel/cgroup/cgroup.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 764bdd5fd8d1..72e97422e9d9 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -6218,6 +6218,11 @@ static struct cgroup *cgroup_get_from_file(struct file *f) return ERR_CAST(css); cgrp = css->cgroup; + if (!cgroup_on_dfl(cgrp)) { + cgroup_put(cgrp); + return ERR_PTR(-EBADF); + } + return cgrp; } -- 2.38.0.rc1.362.ged0d419d3c-goog