summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/syscalls/linux/sys_socket.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-04-13 20:05:27 +0000
committergVisor bot <gvisor-bot@google.com>2020-04-13 20:05:27 +0000
commit334ab60588a39f7e0388a1761c98ca5e1efd4a81 (patch)
treeb18af0a5df46070c905a5929ae62ac271602fbee /pkg/sentry/syscalls/linux/sys_socket.go
parentd65d74c5a6fc2ed89ac3740e7f6f509617bf3468 (diff)
parent5d885d7fb21414d903d57ffe2b95bcc62c098d6a (diff)
Merge release-20200323.0-136-g5d885d7 (automated)
Diffstat (limited to 'pkg/sentry/syscalls/linux/sys_socket.go')
-rw-r--r--pkg/sentry/syscalls/linux/sys_socket.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/sentry/syscalls/linux/sys_socket.go b/pkg/sentry/syscalls/linux/sys_socket.go
index 2919228d0..61b2576ac 100644
--- a/pkg/sentry/syscalls/linux/sys_socket.go
+++ b/pkg/sentry/syscalls/linux/sys_socket.go
@@ -31,6 +31,8 @@ import (
"gvisor.dev/gvisor/pkg/usermem"
)
+// LINT.IfChange
+
// minListenBacklog is the minimum reasonable backlog for listening sockets.
const minListenBacklog = 8
@@ -244,7 +246,10 @@ func SocketPair(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sy
// Copy the file descriptors out.
if _, err := t.CopyOut(socks, fds); err != nil {
- // Note that we don't close files here; see pipe(2) also.
+ for _, fd := range fds {
+ _, file := t.FDTable().Remove(fd)
+ file.DecRef()
+ }
return 0, nil, err
}
@@ -1128,3 +1133,5 @@ func SendTo(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscal
n, err := sendTo(t, fd, bufPtr, bufLen, flags, namePtr, nameLen)
return n, nil, err
}
+
+// LINT.ThenChange(./vfs2/socket.go)