summaryrefslogtreecommitdiff
path: root/fs/fuse
diff options
context:
space:
mode:
authorXiangsheng Hou <xiangsheng.hou@mediatek.com>2025-04-07 19:50:49 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-05-02 07:44:14 +0200
commit5ee09cdaf3414f6c92960714af46d3d90eede2f3 (patch)
tree129306ae0b3aff6d3e873e74324d2d2f8bf9e614 /fs/fuse
parentaac80c3e05cb97e77a39450de7a2a9e29ddf18e6 (diff)
downloadlinux-5ee09cdaf3414f6c92960714af46d3d90eede2f3.tar.gz
linux-5ee09cdaf3414f6c92960714af46d3d90eede2f3.tar.bz2
linux-5ee09cdaf3414f6c92960714af46d3d90eede2f3.zip
virtiofs: add filesystem context source name check
commit a94fd938df2b1628da66b498aa0eeb89593bc7a2 upstream. 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: a62a8ef9d97d ("virtio-fs: add virtiofs filesystem") Cc: <stable@vger.kernel.org> # all LTS kernels Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com> Link: https://lore.kernel.org/20250407115111.25535-1-xiangsheng.hou@mediatek.com Signed-off-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/virtio_fs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
index a4deacc6f78c..ba8d5f5dbeb0 100644
--- a/fs/fuse/virtio_fs.c
+++ b/fs/fuse/virtio_fs.c
@@ -1431,6 +1431,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.