Unverified Commit a94fd938 authored by Xiangsheng Hou's avatar Xiangsheng Hou Committed by Christian Brauner
Browse files

virtiofs: add filesystem context source name check



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.

Fixes: a62a8ef9 ("virtio-fs: add virtiofs filesystem")
Cc: <stable@vger.kernel.org> # all LTS kernels
Signed-off-by: default avatarXiangsheng Hou <xiangsheng.hou@mediatek.com>
Link: https://lore.kernel.org/20250407115111.25535-1-xiangsheng.hou@mediatek.com


Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent cfa5f336
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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.