[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250221020325.7184-1-xiangsheng.hou@mediatek.com>
Date: Fri, 21 Feb 2025 10:03:19 +0800
From: Xiangsheng Hou <xiangsheng.hou@...iatek.com>
To: Vivek Goyal <vgoyal@...hat.com>, Stefan Hajnoczi <stefanha@...hat.com>,
Miklos Szeredi <miklos@...redi.hu>, <eperezma@...hat.com>, Matthias Brugger
<matthias.bgg@...il.com>, AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
CC: <virtualization@...ts.linux.dev>, <linux-fsdevel@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>, <xiangsheng.hou@...iatek.com>,
<benliang.zhao@...iatek.com>, <bin.zhang@...iatek.com>
Subject: [PATCH] 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.
Signed-off-by: Xiangsheng Hou <xiangsheng.hou@...iatek.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
Powered by blists - more mailing lists