Skip to content

Commit a94fd93

Browse files
mtk-xiangshengbrauner
authored andcommitted
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: a62a8ef ("virtio-fs: add virtiofs filesystem") Cc: <[email protected]> # all LTS kernels Signed-off-by: Xiangsheng Hou <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent cfa5f33 commit a94fd93

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/fuse/virtio_fs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,6 +1669,9 @@ static int virtio_fs_get_tree(struct fs_context *fsc)
16691669
unsigned int virtqueue_size;
16701670
int err = -EIO;
16711671

1672+
if (!fsc->source)
1673+
return invalf(fsc, "No source specified");
1674+
16721675
/* This gets a reference on virtio_fs object. This ptr gets installed
16731676
* in fc->iq->priv. Once fuse_conn is going away, it calls ->put()
16741677
* to drop the reference to this object.

0 commit comments

Comments
 (0)