summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-04-14 22:13:15 +0000
committergVisor bot <gvisor-bot@google.com>2020-04-14 22:13:15 +0000
commit540c3487ade5691fd559cc4375529a4a705f583c (patch)
treeaef3e772213da512b1af9a9ec1324cd4f116daa1
parent3f348ccf70e5c866708c6f73f6c6c0798b94bf53 (diff)
parent2dd6384de89a866bddb9184b8d7ab85b5b8f7100 (diff)
Merge release-20200323.0-154-g2dd6384 (automated)
-rw-r--r--pkg/sentry/syscalls/linux/sys_socket.go5
-rwxr-xr-xpkg/sentry/syscalls/linux/vfs2/socket.go5
2 files changed, 6 insertions, 4 deletions
diff --git a/pkg/sentry/syscalls/linux/sys_socket.go b/pkg/sentry/syscalls/linux/sys_socket.go
index 61b2576ac..0760af77b 100644
--- a/pkg/sentry/syscalls/linux/sys_socket.go
+++ b/pkg/sentry/syscalls/linux/sys_socket.go
@@ -247,8 +247,9 @@ func SocketPair(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sy
// Copy the file descriptors out.
if _, err := t.CopyOut(socks, fds); err != nil {
for _, fd := range fds {
- _, file := t.FDTable().Remove(fd)
- file.DecRef()
+ if file, _ := t.FDTable().Remove(fd); file != nil {
+ file.DecRef()
+ }
}
return 0, nil, err
}
diff --git a/pkg/sentry/syscalls/linux/vfs2/socket.go b/pkg/sentry/syscalls/linux/vfs2/socket.go
index 79a4a7ada..b1ede32f0 100755
--- a/pkg/sentry/syscalls/linux/vfs2/socket.go
+++ b/pkg/sentry/syscalls/linux/vfs2/socket.go
@@ -250,8 +250,9 @@ func SocketPair(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sy
if _, err := t.CopyOut(addr, fds); err != nil {
for _, fd := range fds {
- _, file := t.FDTable().Remove(fd)
- file.DecRef()
+ if _, file := t.FDTable().Remove(fd); file != nil {
+ file.DecRef()
+ }
}
return 0, nil, err
}