diff options
author | Ayush Ranjan <ayushranjan@google.com> | 2020-09-24 13:44:25 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-09-24 13:48:01 -0700 |
commit | 832d91b8058c3c716c648701cf93095dd3157541 (patch) | |
tree | 821bd48b2c436c392e1b7ccf0459df07854934ba /pkg/sentry/fsimpl/devpts/master.go | |
parent | 5f8c653542641408a0d3a045d645e06883b7ac91 (diff) |
[vfs] kernfs: Do not hold reference on the inode when opening FD.
The FD should hold a reference on the dentry they were opened on which in turn
holds a reference on the inode it points to.
PiperOrigin-RevId: 333589223
Diffstat (limited to 'pkg/sentry/fsimpl/devpts/master.go')
-rw-r--r-- | pkg/sentry/fsimpl/devpts/master.go | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/pkg/sentry/fsimpl/devpts/master.go b/pkg/sentry/fsimpl/devpts/master.go index bfcaf60bd..69c2fe951 100644 --- a/pkg/sentry/fsimpl/devpts/master.go +++ b/pkg/sentry/fsimpl/devpts/master.go @@ -58,14 +58,12 @@ func (mi *masterInode) Open(ctx context.Context, rp *vfs.ResolvingPath, d *kernf return nil, err } - mi.IncRef() fd := &masterFileDescription{ inode: mi, t: t, } fd.LockFD.Init(&mi.locks) if err := fd.vfsfd.Init(fd, opts.Flags, rp.Mount(), d.VFSDentry(), &vfs.FileDescriptionOptions{}); err != nil { - mi.DecRef(ctx) return nil, err } return &fd.vfsfd, nil @@ -106,7 +104,6 @@ var _ vfs.FileDescriptionImpl = (*masterFileDescription)(nil) // Release implements vfs.FileDescriptionImpl.Release. func (mfd *masterFileDescription) Release(ctx context.Context) { mfd.inode.root.masterClose(mfd.t) - mfd.inode.DecRef(ctx) } // EventRegister implements waiter.Waitable.EventRegister. |