summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/overlay
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2020-08-25 14:58:28 -0700
committergVisor bot <gvisor-bot@google.com>2020-08-25 15:00:31 -0700
commitc28bbee993daea0efe2cc4cce6fdb6cbcf93c470 (patch)
tree2c174a11f2f5694a37566d9c3cdd20c9a91dab13 /pkg/sentry/fsimpl/overlay
parent1f0d23c7ade25ebdcae9279e0a8054ef17474f46 (diff)
overlay: clonePrivateMount must pass a Dentry reference to MakeVirtualDentry.
PiperOrigin-RevId: 328410065
Diffstat (limited to 'pkg/sentry/fsimpl/overlay')
-rw-r--r--pkg/sentry/fsimpl/overlay/overlay.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/sentry/fsimpl/overlay/overlay.go b/pkg/sentry/fsimpl/overlay/overlay.go
index 4b3dfbc01..00562667f 100644
--- a/pkg/sentry/fsimpl/overlay/overlay.go
+++ b/pkg/sentry/fsimpl/overlay/overlay.go
@@ -315,7 +315,11 @@ func clonePrivateMount(vfsObj *vfs.VirtualFilesystem, vd vfs.VirtualDentry, forc
if err != nil {
return vfs.VirtualDentry{}, err
}
- return vfs.MakeVirtualDentry(newmnt, vd.Dentry()), nil
+ // Take a reference on the dentry which will be owned by the returned
+ // VirtualDentry.
+ d := vd.Dentry()
+ d.IncRef()
+ return vfs.MakeVirtualDentry(newmnt, d), nil
}
// Release implements vfs.FilesystemImpl.Release.