diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2023-04-24 19:14:20 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2023-04-24 19:14:20 -0700 |
commit | ef36b9afc2edb0764cb3df7a1cb5e86406267b40 (patch) | |
tree | e137ffdb1c556c9c6e91626e74e8ee6bb6e33c25 /fs/namespace.c | |
parent | 61d325dcbc05d8fef88110d35ef7776f3ac3f68b (diff) | |
parent | 4a892c0fe4bb0546d68a89fa595bd22cb4be2576 (diff) |
Merge tag 'pull-fd' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs fget updates from Al Viro:
"fget() to fdget() conversions"
* tag 'pull-fd' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
fuse_dev_ioctl(): switch to fdget()
cgroup_get_from_fd(): switch to fdget_raw()
bpf: switch to fdget_raw()
build_mount_idmapped(): switch to fdget()
kill the last remaining user of proc_ns_fget()
SVM-SEV: convert the rest of fget() uses to fdget() in there
convert sgx_set_attribute() to fdget()/fdput()
convert setns(2) to fdget()/fdput()
Diffstat (limited to 'fs/namespace.c')
-rw-r--r-- | fs/namespace.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index c37a68f7ba72..54847db5b819 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -4194,7 +4194,7 @@ static int build_mount_idmapped(const struct mount_attr *attr, size_t usize, int err = 0; struct ns_common *ns; struct user_namespace *mnt_userns; - struct file *file; + struct fd f; if (!((attr->attr_set | attr->attr_clr) & MOUNT_ATTR_IDMAP)) return 0; @@ -4210,16 +4210,16 @@ static int build_mount_idmapped(const struct mount_attr *attr, size_t usize, if (attr->userns_fd > INT_MAX) return -EINVAL; - file = fget(attr->userns_fd); - if (!file) + f = fdget(attr->userns_fd); + if (!f.file) return -EBADF; - if (!proc_ns_file(file)) { + if (!proc_ns_file(f.file)) { err = -EINVAL; goto out_fput; } - ns = get_proc_ns(file_inode(file)); + ns = get_proc_ns(file_inode(f.file)); if (ns->ops->type != CLONE_NEWUSER) { err = -EINVAL; goto out_fput; @@ -4248,7 +4248,7 @@ static int build_mount_idmapped(const struct mount_attr *attr, size_t usize, kattr->mnt_userns = get_user_ns(mnt_userns); out_fput: - fput(file); + fdput(f); return err; } |