Skip to content

Commit 96e85e9

Browse files
author
Al Viro
committed
build_mount_idmapped(): switch to fdget()
Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 38e1240 commit 96e85e9

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

fs/namespace.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4197,7 +4197,7 @@ static int build_mount_idmapped(const struct mount_attr *attr, size_t usize,
41974197
int err = 0;
41984198
struct ns_common *ns;
41994199
struct user_namespace *mnt_userns;
4200-
struct file *file;
4200+
struct fd f;
42014201

42024202
if (!((attr->attr_set | attr->attr_clr) & MOUNT_ATTR_IDMAP))
42034203
return 0;
@@ -4213,16 +4213,16 @@ static int build_mount_idmapped(const struct mount_attr *attr, size_t usize,
42134213
if (attr->userns_fd > INT_MAX)
42144214
return -EINVAL;
42154215

4216-
file = fget(attr->userns_fd);
4217-
if (!file)
4216+
f = fdget(attr->userns_fd);
4217+
if (!f.file)
42184218
return -EBADF;
42194219

4220-
if (!proc_ns_file(file)) {
4220+
if (!proc_ns_file(f.file)) {
42214221
err = -EINVAL;
42224222
goto out_fput;
42234223
}
42244224

4225-
ns = get_proc_ns(file_inode(file));
4225+
ns = get_proc_ns(file_inode(f.file));
42264226
if (ns->ops->type != CLONE_NEWUSER) {
42274227
err = -EINVAL;
42284228
goto out_fput;
@@ -4251,7 +4251,7 @@ static int build_mount_idmapped(const struct mount_attr *attr, size_t usize,
42514251
kattr->mnt_userns = get_user_ns(mnt_userns);
42524252

42534253
out_fput:
4254-
fput(file);
4254+
fdput(f);
42554255
return err;
42564256
}
42574257

0 commit comments

Comments
 (0)