diff options
| author | Miklos Szeredi <mszeredi@redhat.com> | 2026-05-28 10:58:24 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-07-04 13:39:37 +0200 |
| commit | 1cc0e3a0c6499aaaa2f21a4fcbba388486afb25e (patch) | |
| tree | 1d8ae24cc615fe7aa3909e2901a039eb28d83c9f | |
| parent | f0f5a1d7056980a0d512456fdb370cfb72bba86a (diff) | |
| download | linux-stable-1cc0e3a0c6499aaaa2f21a4fcbba388486afb25e.tar.gz linux-stable-1cc0e3a0c6499aaaa2f21a4fcbba388486afb25e.zip | |
virtiofs: fix UAF on submount umount
commit 06b41351779e9289e8785694ade9042ae85e41ea upstream.
iput() called from fuse_release_end() can Oops if the super block has
already been destroyed. Normally this is prevented by waiting for
num_waiting to go down to zero before commencing with super block shutdown.
This only works, however, for the last submount instance, as the wait
counter is per connection, not per superblock.
Revert to using synchronous release requests for the auto_submounts case,
which is virtiofs only at this time.
Reported-by: Aurélien Bombo <abombo@microsoft.com>
Reported-by: Zhihao Cheng <chengzhihao1@huawei.com>
Cc: Greg Kurz <gkurz@redhat.com>
Closes: https://github.com/kata-containers/kata-containers/issues/12589
Fixes: 26e5c67deb2e ("fuse: fix livelock in synchronous file put from fuseblk workers")
Cc: stable@vger.kernel.org
Reviewed-by: Greg Kurz <gkurz@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | fs/fuse/file.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 8e10d89f2507..2bcb3bbcc4b5 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -358,8 +358,14 @@ void fuse_file_release(struct inode *inode, struct fuse_file *ff, * aio and closes the fd before the aio completes. Since aio takes its * own ref to the file, the IO completion has to drop the ref, which is * how the fuse server can end up closing its clients' files. + * + * Exception is virtio-fs, which is not affected by the above (server is + * on host, cannot close open files in guest). Virtio-fs needs sync + * release, because the num_waiting mechanism to wait for all requests + * before commencing with fs shutdown doesn't work if submounts are + * used. */ - fuse_file_put(ff, false); + fuse_file_put(ff, ff->fm->fc->auto_submounts); } void fuse_release_common(struct file *file, bool isdir) |
