Skip to content

Commit 21166bd

Browse files
mtk-xiangshengjfvogel
authored andcommitted
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: 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit c3e31d613951c299487844c4d1686a933e8ee291) Signed-off-by: Jack Vogel <[email protected]>
1 parent aa1c42c commit 21166bd

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
@@ -1663,6 +1663,9 @@ static int virtio_fs_get_tree(struct fs_context *fsc)
16631663
unsigned int virtqueue_size;
16641664
int err = -EIO;
16651665

1666+
if (!fsc->source)
1667+
return invalf(fsc, "No source specified");
1668+
16661669
/* This gets a reference on virtio_fs object. This ptr gets installed
16671670
* in fc->iq->priv. Once fuse_conn is going away, it calls ->put()
16681671
* to drop the reference to this object.

0 commit comments

Comments
 (0)