diff options
author | Dean Deng <deandeng@google.com> | 2020-10-13 11:29:21 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-10-13 11:31:22 -0700 |
commit | 432963dd2d9f4797f26a8b2555464a50f8319537 (patch) | |
tree | 8cf1e7fd7529fa98af146a70ce508cdad8a797e0 /pkg/sentry/fs/user/path.go | |
parent | d9b32efb306444440daa89a79e4d85516ff8f340 (diff) |
[vfs2] Don't take reference in Task.MountNamespaceVFS2 and MountNamespace.Root.
This fixes reference leaks related to accidentally forgetting to DecRef()
after calling one or the other.
PiperOrigin-RevId: 336918922
Diffstat (limited to 'pkg/sentry/fs/user/path.go')
-rw-r--r-- | pkg/sentry/fs/user/path.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/pkg/sentry/fs/user/path.go b/pkg/sentry/fs/user/path.go index 2f5a43b84..124bc95ed 100644 --- a/pkg/sentry/fs/user/path.go +++ b/pkg/sentry/fs/user/path.go @@ -121,6 +121,7 @@ func resolve(ctx context.Context, mns *fs.MountNamespace, paths []string, name s func resolveVFS2(ctx context.Context, creds *auth.Credentials, mns *vfs.MountNamespace, paths []string, name string) (string, error) { root := mns.Root() + root.IncRef() defer root.DecRef(ctx) for _, p := range paths { if !path.IsAbs(p) { |