Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND] virtiofs: add filesystem context source name check
@ 2025-04-07 11:50 Xiangsheng Hou
  2025-04-07 13:21 ` Christian Brauner
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Xiangsheng Hou @ 2025-04-07 11:50 UTC (permalink / raw)
  To: Vivek Goyal, Stefan Hajnoczi, Miklos Szeredi, eperezma,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: virtualization, linux-fsdevel, linux-kernel, linux-arm-kernel,
	linux-mediatek, benliang.zhao, bin.zhang, Xiangsheng Hou

In certain scenarios, for example, during fuzz testing, the source
name may be NULL, which could lead to a kernel panic. Therefore, an
extra check for the source name should be added.

Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
---
 fs/fuse/virtio_fs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
index 2c7b24cb67ad..53c2626e90e7 100644
--- a/fs/fuse/virtio_fs.c
+++ b/fs/fuse/virtio_fs.c
@@ -1669,6 +1669,9 @@ static int virtio_fs_get_tree(struct fs_context *fsc)
 	unsigned int virtqueue_size;
 	int err = -EIO;
 
+	if (!fsc->source)
+		return invalf(fsc, "No source specified");
+
 	/* This gets a reference on virtio_fs object. This ptr gets installed
 	 * in fc->iq->priv. Once fuse_conn is going away, it calls ->put()
 	 * to drop the reference to this object.
-- 
2.46.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-04-07 14:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07 11:50 [RESEND] virtiofs: add filesystem context source name check Xiangsheng Hou
2025-04-07 13:21 ` Christian Brauner
2025-04-07 13:24 ` Christian Brauner
2025-04-07 14:24 ` Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox