summaryrefslogtreecommitdiff
path: root/fs/fuse
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2021-04-14 11:40:58 +0300
committerMiklos Szeredi <mszeredi@redhat.com>2021-04-14 11:40:58 +0300
commit0a7419c68a45d2d066b996be5087aa2d07ce80eb (patch)
tree7877ad91378f33977d61e731751f64c8a37735d8 /fs/fuse
parent07595bfa24ce7e8ecef70c84fee9a2374d8c0a61 (diff)
downloadlinux-0a7419c68a45d2d066b996be5087aa2d07ce80eb.tar.xz
virtiofs: fix userns
get_user_ns() is done twice (once in virtio_fs_get_tree() and once in fuse_conn_init()), resulting in a reference leak. Also looks better to use fsc->user_ns (which *should* be the current_user_ns() at this point). Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/virtio_fs.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
index 6623f27e88d4..bcb8a02e2d8b 100644
--- a/fs/fuse/virtio_fs.c
+++ b/fs/fuse/virtio_fs.c
@@ -1443,8 +1443,7 @@ static int virtio_fs_get_tree(struct fs_context *fsc)
if (!fm)
goto out_err;
- fuse_conn_init(fc, fm, get_user_ns(current_user_ns()),
- &virtio_fs_fiq_ops, fs);
+ fuse_conn_init(fc, fm, fsc->user_ns, &virtio_fs_fiq_ops, fs);
fc->release = fuse_free_conn;
fc->delete_stale = true;
fc->auto_submounts = true;