summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/vfs/mount.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-02-14 19:16:42 +0000
committergVisor bot <gvisor-bot@google.com>2020-02-14 19:16:42 +0000
commitf14b6a9db839352020e7284670feafad36647a56 (patch)
tree6e2e0a91363f440789b01e6e355787f99f3ed786 /pkg/sentry/vfs/mount.go
parent10427e352365bfac7f5e458d19055b48c7d08bcb (diff)
parent4075de11be44372c454aae7f9650cdc814c52229 (diff)
Merge release-20200211.0-17-g4075de1 (automated)
Diffstat (limited to 'pkg/sentry/vfs/mount.go')
-rwxr-xr-xpkg/sentry/vfs/mount.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/pkg/sentry/vfs/mount.go b/pkg/sentry/vfs/mount.go
index 1fbb420f9..ad2c9fcf4 100755
--- a/pkg/sentry/vfs/mount.go
+++ b/pkg/sentry/vfs/mount.go
@@ -114,6 +114,7 @@ type MountNamespace struct {
func (vfs *VirtualFilesystem) NewMountNamespace(ctx context.Context, creds *auth.Credentials, source, fsTypeName string, opts *GetFilesystemOptions) (*MountNamespace, error) {
rft := vfs.getFilesystemType(fsTypeName)
if rft == nil {
+ ctx.Warningf("Unknown filesystem: %s", fsTypeName)
return nil, syserror.ENODEV
}
fs, root, err := rft.fsType.GetFilesystem(ctx, vfs, creds, source, *opts)
@@ -231,9 +232,12 @@ func (vfs *VirtualFilesystem) UmountAt(ctx context.Context, creds *auth.Credenti
return syserror.EINVAL
}
vfs.mountMu.Lock()
- if mntns := MountNamespaceFromContext(ctx); mntns != nil && mntns != vd.mount.ns {
- vfs.mountMu.Unlock()
- return syserror.EINVAL
+ if mntns := MountNamespaceFromContext(ctx); mntns != nil {
+ defer mntns.DecRef()
+ if mntns != vd.mount.ns {
+ vfs.mountMu.Unlock()
+ return syserror.EINVAL
+ }
}
// TODO(jamieliu): Linux special-cases umount of the caller's root, which