diff options
author | Nicolas Lacasse <nlacasse@google.com> | 2020-08-25 14:58:28 -0700 |
---|---|---|
committer | Andrei Vagin <avagin@gmail.com> | 2020-09-09 17:53:10 -0700 |
commit | 7483666eca67bf7d7ee814a4c8667af575f15bda (patch) | |
tree | 2c174a11f2f5694a37566d9c3cdd20c9a91dab13 /pkg | |
parent | 09bd5a57f3456bb411c34cced923531dc8e0aec7 (diff) |
overlay: clonePrivateMount must pass a Dentry reference to MakeVirtualDentry.
PiperOrigin-RevId: 328410065
Diffstat (limited to 'pkg')
-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. |