From 8e1deb2ab8fb67da9a1f6521e31c5635ac587e71 Mon Sep 17 00:00:00 2001 From: Christopher Koch Date: Wed, 16 May 2018 14:53:57 -0700 Subject: Fix another socket Dirent refcount. PiperOrigin-RevId: 196893452 Change-Id: I5ea0f851fcabc5eac5859e61f15213323d996337 --- pkg/sentry/socket/rpcinet/socket.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'pkg') diff --git a/pkg/sentry/socket/rpcinet/socket.go b/pkg/sentry/socket/rpcinet/socket.go index 2911d3fd6..11925f8d8 100644 --- a/pkg/sentry/socket/rpcinet/socket.go +++ b/pkg/sentry/socket/rpcinet/socket.go @@ -71,6 +71,7 @@ func newSocketFile(ctx context.Context, stack *Stack, family int, skType int, pr stack.notifier.AddFD(fd, &wq) dirent := socket.NewDirent(ctx, socketDevice) + defer dirent.DecRef() return fs.NewFile(ctx, dirent, fs.FileFlags{Read: true, Write: true}, &socketOperations{ wq: &wq, fd: fd, @@ -274,6 +275,7 @@ func (s *socketOperations) Accept(t *kernel.Task, peerRequested bool, flags int, s.notifier.AddFD(payload.Fd, &wq) dirent := socket.NewDirent(t, socketDevice) + defer dirent.DecRef() file := fs.NewFile(t, dirent, fs.FileFlags{Read: true, Write: true, NonBlocking: flags&linux.SOCK_NONBLOCK != 0}, &socketOperations{ wq: &wq, fd: payload.Fd, -- cgit v1.2.3