summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/fuse/dev.go
diff options
context:
space:
mode:
authorJinmou Li <jinmli@google.com>2020-09-03 19:22:24 +0000
committerAndrei Vagin <avagin@gmail.com>2020-09-11 13:35:25 -0700
commit5a28bc6121c2cb076e24036386241e32a5745b40 (patch)
tree1822d67b0aab509500e588eb6768a63d65c42566 /pkg/sentry/fsimpl/fuse/dev.go
parent84acc461cda70348a70992aac984c0e6e2b1621f (diff)
Fix FUSE_RELEASE protocol reply processing
This commit fixes the potential unexpected errors of original handling of FUSE_RELEASE responses while keep the same behavior (ignoring any reply).
Diffstat (limited to 'pkg/sentry/fsimpl/fuse/dev.go')
-rw-r--r--pkg/sentry/fsimpl/fuse/dev.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/sentry/fsimpl/fuse/dev.go b/pkg/sentry/fsimpl/fuse/dev.go
index e7296c189..6f0b896cb 100644
--- a/pkg/sentry/fsimpl/fuse/dev.go
+++ b/pkg/sentry/fsimpl/fuse/dev.go
@@ -204,8 +204,11 @@ func (fd *DeviceFD) readLocked(ctx context.Context, dst usermem.IOSequence, opts
// Fully done with this req, remove it from the queue.
fd.queue.Remove(req)
- if req.hdr.Opcode == linux.FUSE_RELEASE {
+
+ // Remove noReply ones from map of requests expecting a reply.
+ if req.noReply {
fd.numActiveRequests -= 1
+ delete(fd.completions, req.hdr.Unique)
}
return int64(n), nil
@@ -296,6 +299,10 @@ func (fd *DeviceFD) writeLocked(ctx context.Context, src usermem.IOSequence, opt
fut, ok := fd.completions[hdr.Unique]
if !ok {
+ if fut.hdr.Unique == linux.FUSE_RELEASE {
+ // Currently we simply discard the reply for FUSE_RELEASE.
+ return n + src.NumBytes(), nil
+ }
// Server sent us a response for a request we never sent?
return 0, syserror.EINVAL
}