Skip to content

Commit

Permalink
cgroup_get_from_fd(): switch to fdget_raw()
Browse files Browse the repository at this point in the history
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Apr 21, 2023
1 parent 1d0027d commit 2f31fa0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions kernel/cgroup/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -6856,14 +6856,12 @@ EXPORT_SYMBOL_GPL(cgroup_get_from_path);
struct cgroup *cgroup_v1v2_get_from_fd(int fd)
{
struct cgroup *cgrp;
struct file *f;

f = fget_raw(fd);
if (!f)
struct fd f = fdget_raw(fd);
if (!f.file)
return ERR_PTR(-EBADF);

cgrp = cgroup_v1v2_get_from_file(f);
fput(f);
cgrp = cgroup_v1v2_get_from_file(f.file);
fdput(f);
return cgrp;
}

Expand Down

0 comments on commit 2f31fa0

Please sign in to comment.