Skip to content

Commit 457a654

Browse files
author
Al Viro
committed
css_set_fork(): switch to CLASS(fd_raw, ...)
reference acquired there by fget_raw() is not stashed anywhere - we could as well borrow instead. Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 7133dd5 commit 457a654

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

kernel/cgroup/cgroup.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6476,7 +6476,6 @@ static int cgroup_css_set_fork(struct kernel_clone_args *kargs)
64766476
struct cgroup *dst_cgrp = NULL;
64776477
struct css_set *cset;
64786478
struct super_block *sb;
6479-
struct file *f;
64806479

64816480
if (kargs->flags & CLONE_INTO_CGROUP)
64826481
cgroup_lock();
@@ -6493,14 +6492,14 @@ static int cgroup_css_set_fork(struct kernel_clone_args *kargs)
64936492
return 0;
64946493
}
64956494

6496-
f = fget_raw(kargs->cgroup);
6497-
if (!f) {
6495+
CLASS(fd_raw, f)(kargs->cgroup);
6496+
if (fd_empty(f)) {
64986497
ret = -EBADF;
64996498
goto err;
65006499
}
6501-
sb = f->f_path.dentry->d_sb;
6500+
sb = fd_file(f)->f_path.dentry->d_sb;
65026501

6503-
dst_cgrp = cgroup_get_from_file(f);
6502+
dst_cgrp = cgroup_get_from_file(fd_file(f));
65046503
if (IS_ERR(dst_cgrp)) {
65056504
ret = PTR_ERR(dst_cgrp);
65066505
dst_cgrp = NULL;
@@ -6548,15 +6547,12 @@ static int cgroup_css_set_fork(struct kernel_clone_args *kargs)
65486547
}
65496548

65506549
put_css_set(cset);
6551-
fput(f);
65526550
kargs->cgrp = dst_cgrp;
65536551
return ret;
65546552

65556553
err:
65566554
cgroup_threadgroup_change_end(current);
65576555
cgroup_unlock();
6558-
if (f)
6559-
fput(f);
65606556
if (dst_cgrp)
65616557
cgroup_put(dst_cgrp);
65626558
put_css_set(cset);

0 commit comments

Comments
 (0)