From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: "Miklos Szeredi" <mszeredi@redhat.com>,
"Aurélien Bombo" <abombo@microsoft.com>,
"Zhihao Cheng" <chengzhihao1@huawei.com>,
"Greg Kurz" <gkurz@redhat.com>, "Sasha Levin" <sashal@kernel.org>
Subject: [PATCH 5.10.y] virtiofs: fix UAF on submount umount
Date: Thu, 25 Jun 2026 13:56:09 -0400 [thread overview]
Message-ID: <20260625175609.2544109-1-sashal@kernel.org> (raw)
In-Reply-To: <2026062516-legroom-wrongdoer-ad3f@gregkh>
From: Miklos Szeredi <mszeredi@redhat.com>
[ Upstream commit 06b41351779e9289e8785694ade9042ae85e41ea ]
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: Sasha Levin <sashal@kernel.org>
---
fs/fuse/file.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 23bc96887abcb7..a8c080b485d036 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -330,8 +330,14 @@ void fuse_release_common(struct file *file, bool isdir)
* 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, isdir);
+ fuse_file_put(ff, ff->fm->fc->auto_submounts, isdir);
}
static int fuse_open(struct inode *inode, struct file *file)
--
2.53.0
prev parent reply other threads:[~2026-06-25 17:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-25 12:48 FAILED: patch "[PATCH] virtiofs: fix UAF on submount umount" failed to apply to 5.10-stable tree gregkh
2026-06-25 17:56 ` Sasha Levin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260625175609.2544109-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=abombo@microsoft.com \
--cc=chengzhihao1@huawei.com \
--cc=gkurz@redhat.com \
--cc=mszeredi@redhat.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox