[Virtio-fs] [PATCH] virtiofsd: fix lo_do_lookup panic

Peng Tao tao.peng at linux.alibaba.com
Thu Jun 6 07:16:15 UTC 2019


It needs to check for invalid parent dir.

Signed-off-by: Peng Tao <tao.peng at linux.alibaba.com>
---
 contrib/virtiofsd/passthrough_ll.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/contrib/virtiofsd/passthrough_ll.c b/contrib/virtiofsd/passthrough_ll.c
index 8a3adc9..f544387 100644
--- a/contrib/virtiofsd/passthrough_ll.c
+++ b/contrib/virtiofsd/passthrough_ll.c
@@ -640,6 +640,9 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
 	struct lo_data *lo = lo_data(req);
 	struct lo_inode *inode, *dir = lo_inode(req, parent);
 
+	if (dir == NULL)
+		return EBADF;
+
 	memset(e, 0, sizeof(*e));
 	e->attr_timeout = lo->timeout;
 	e->entry_timeout = lo->timeout;
-- 
1.8.3.1




More information about the Virtio-fs mailing list