Skip to contentSkip to conversation

virtiofsd: fix lo_do_lookup panic

PATCH In review Peng Tao 3 participants 3 messages Jun 6, 2019

lore
Share & tools
lore

Peng Tao

author
#0 lore raw

PATCH 1/1 virtiofsd: fix lo_do_lookup panic

It needs to check for invalid parent dir.

---
 contrib/virtiofsd/passthrough_ll.c | 3 +++
 1 file changed, 3 insertions(+)
contrib/virtiofsd/passthrough_ll.c +3 -0
index 8a3adc9..f544387 100644
@@ -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;
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 3 lines · * Peng Tao ([email protected]) wrote:

It needs to check for invalid parent dir.

This is the same as Liu Bo's patch from 23rd May; but there was some discussion about what to do about open_by_handle_at. Did we ever get an answer to that?

Dave

Quoted 21 lines
---
 contrib/virtiofsd/passthrough_ll.c | 3 +++
 1 file changed, 3 insertions(+)
contrib/virtiofsd/passthrough_ll.c +3 -0
index 8a3adc9..f544387 100644
@@ -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;
Signature · 1 line
1.8.3.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#2 lore raw
Quoted 8 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Peng Tao ([email protected]) wrote:

It needs to check for invalid parent dir.

This is the same as Liu Bo's patch from 23rd May; but there was some discussion about what to do about open_by_handle_at. Did we ever get an answer to that?

No answer yet, here we haven't got a usecase which is uing exportfs.

The discussion was related but not rejecting the patch, it's about whether we should disable exportfs if we cannot support it well.

Peng's patch returns EBADF while mine was returning ENOENT, I'm OK with either errno, up to you :-)

thanks,
-liubo

Quoted 26 lines

Dave

Quoted 21 lines
---
 contrib/virtiofsd/passthrough_ll.c | 3 +++
 1 file changed, 3 insertions(+)
contrib/virtiofsd/passthrough_ll.c +3 -0
index 8a3adc9..f544387 100644
@@ -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;
Signature · 1 line
1.8.3.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK