All of lore.kernel.org
 help / color / mirror / Atom feed
* [Virtio-fs] [PATCH] Fix file descriptor passed for setupmapping
@ 2020-05-13 16:33 Fotis Xenakis
  2020-05-15  3:48 ` Liu Bo
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Fotis Xenakis @ 2020-05-13 16:33 UTC (permalink / raw)
  To: virtio-fs

Currently, during FUSE_SETUPMAPPING, virtiofsd passes the wrong file
descriptor for the file to mmap() to QEMU (specifically, it passes the
file handle as requested from the guest).

This fixes it, using lo_fi_fd() to map the file handle to the right file
descriptor on the host.

Signed-off-by: Fotis Xenakis <foxen@windowslive.com>
---
 tools/virtiofsd/passthrough_ll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
index e09d557d74..44bb24eb5e 100644
--- a/tools/virtiofsd/passthrough_ll.c
+++ b/tools/virtiofsd/passthrough_ll.c
@@ -2709,7 +2709,7 @@ static void lo_setupmapping(fuse_req_t req, fuse_ino_t ino, uint64_t foffset,
     msg.flags[0] = vhu_flags;
 
     if (fi) {
-        fd = fi->fh;
+        fd = lo_fi_fd(req, fi);
     } else {
         res = asprintf(&buf, "%i", lo_fd(req, ino));
         if (res == -1) {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-05-18 21:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-13 16:33 [Virtio-fs] [PATCH] Fix file descriptor passed for setupmapping Fotis Xenakis
2020-05-15  3:48 ` Liu Bo
2020-05-15 16:50   ` Fotis Xenakis
2020-05-18 12:37     ` Vivek Goyal
2020-05-18 21:17       ` Fotis Xenakis
2020-05-15 12:52 ` Vivek Goyal
2020-05-18 10:45 ` Dr. David Alan Gilbert

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.