diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-10-12 17:44:01 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-10-12 17:44:01 +0000 |
commit | 4ba161010c514ab98d004af338fd6238894568db (patch) | |
tree | 6f5c2e321dbfaeb21de81de9059796f982b61cbb /pkg/sentry/vfs/mount.go | |
parent | ae0ab57fdfcadf771cb849b79cdb6d6e0a4bdbbf (diff) | |
parent | d861cd5f14bc42b32eeac20c444a685f1d9748f7 (diff) |
Merge release-20200928.0-91-gd861cd5f1 (automated)
Diffstat (limited to 'pkg/sentry/vfs/mount.go')
-rw-r--r-- | pkg/sentry/vfs/mount.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg/sentry/vfs/mount.go b/pkg/sentry/vfs/mount.go index dfc3ae6c0..79a2d8c41 100644 --- a/pkg/sentry/vfs/mount.go +++ b/pkg/sentry/vfs/mount.go @@ -46,8 +46,9 @@ import ( // +stateify savable type Mount struct { // vfs, fs, root are immutable. References are held on fs and root. + // Note that for a disconnected mount, root may be nil. // - // Invariant: root belongs to fs. + // Invariant: if not nil, root belongs to fs. vfs *VirtualFilesystem fs *Filesystem root *Dentry @@ -498,7 +499,9 @@ func (mnt *Mount) DecRef(ctx context.Context) { mnt.vfs.mounts.seq.EndWrite() mnt.vfs.mountMu.Unlock() } - mnt.root.DecRef(ctx) + if mnt.root != nil { + mnt.root.DecRef(ctx) + } mnt.fs.DecRef(ctx) if vd.Ok() { vd.DecRef(ctx) |