diff options
author | Nicolas Lacasse <nlacasse@google.com> | 2020-08-25 14:58:28 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-08-25 15:00:31 -0700 |
commit | c28bbee993daea0efe2cc4cce6fdb6cbcf93c470 (patch) | |
tree | 2c174a11f2f5694a37566d9c3cdd20c9a91dab13 /pkg/sentry | |
parent | 1f0d23c7ade25ebdcae9279e0a8054ef17474f46 (diff) |
overlay: clonePrivateMount must pass a Dentry reference to MakeVirtualDentry.
PiperOrigin-RevId: 328410065
Diffstat (limited to 'pkg/sentry')
-rw-r--r-- | pkg/sentry/fsimpl/overlay/overlay.go | 6 |
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. |