summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/socket/netlink/provider_vfs2.go
diff options
context:
space:
mode:
authorJamie Liu <jamieliu@google.com>2020-09-28 16:38:39 -0700
committergVisor bot <gvisor-bot@google.com>2020-09-28 16:44:33 -0700
commitba44298a390c69dcf33ae591b9ddc6b3514cc9b3 (patch)
tree9f0e88a46bf01e151ee2cea71d4895e723e8200d /pkg/sentry/socket/netlink/provider_vfs2.go
parent237b761f9a61ad1a821320e68f5a71e7cda6b29e (diff)
Don't leak dentries returned by sockfs.NewDentry().
PiperOrigin-RevId: 334263322
Diffstat (limited to 'pkg/sentry/socket/netlink/provider_vfs2.go')
-rw-r--r--pkg/sentry/socket/netlink/provider_vfs2.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/pkg/sentry/socket/netlink/provider_vfs2.go b/pkg/sentry/socket/netlink/provider_vfs2.go
index bb205be0d..e8930f031 100644
--- a/pkg/sentry/socket/netlink/provider_vfs2.go
+++ b/pkg/sentry/socket/netlink/provider_vfs2.go
@@ -52,6 +52,7 @@ func (*socketProviderVFS2) Socket(t *kernel.Task, stype linux.SockType, protocol
vfsfd := &s.vfsfd
mnt := t.Kernel().SocketMount()
d := sockfs.NewDentry(t.Credentials(), mnt)
+ defer d.DecRef(t)
if err := vfsfd.Init(s, linux.O_RDWR, mnt, d, &vfs.FileDescriptionOptions{
DenyPRead: true,
DenyPWrite: true,