diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-09-16 21:21:14 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-09-16 21:21:14 +0000 |
commit | 81b4980e9ef358a169ea3720ccf65e3e8e2a0f87 (patch) | |
tree | fbbd99084c6f3a79eedc6c5d8448151dcae58dc0 /pkg/tcpip | |
parent | 2cb2cbfc4a6eb66524410a318f603ed5051b04f8 (diff) | |
parent | 666397c5c82ee18a776491919312d19cfe6d4a07 (diff) |
Merge release-20200907.0-64-g666397c5c (automated)
Diffstat (limited to 'pkg/tcpip')
-rw-r--r-- | pkg/tcpip/link/rawfile/errors.go | 8 | ||||
-rw-r--r-- | pkg/tcpip/link/tun/tun_endpoint_refs.go | 5 |
2 files changed, 7 insertions, 6 deletions
diff --git a/pkg/tcpip/link/rawfile/errors.go b/pkg/tcpip/link/rawfile/errors.go index a0a873c84..604868fd8 100644 --- a/pkg/tcpip/link/rawfile/errors.go +++ b/pkg/tcpip/link/rawfile/errors.go @@ -31,10 +31,12 @@ var translations [maxErrno]*tcpip.Error // *tcpip.Error. // // Valid, but unrecognized errnos will be translated to -// tcpip.ErrInvalidEndpointState (EINVAL). Panics on invalid errnos. +// tcpip.ErrInvalidEndpointState (EINVAL). func TranslateErrno(e syscall.Errno) *tcpip.Error { - if err := translations[e]; err != nil { - return err + if e > 0 && e < syscall.Errno(len(translations)) { + if err := translations[e]; err != nil { + return err + } } return tcpip.ErrInvalidEndpointState } diff --git a/pkg/tcpip/link/tun/tun_endpoint_refs.go b/pkg/tcpip/link/tun/tun_endpoint_refs.go index e0595429c..9a38142f5 100644 --- a/pkg/tcpip/link/tun/tun_endpoint_refs.go +++ b/pkg/tcpip/link/tun/tun_endpoint_refs.go @@ -2,11 +2,10 @@ package tun import ( "fmt" - "runtime" - "sync/atomic" - "gvisor.dev/gvisor/pkg/log" refs_vfs1 "gvisor.dev/gvisor/pkg/refs" + "runtime" + "sync/atomic" ) // ownerType is used to customize logging. Note that we use a pointer to T so |