summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-09-02 22:19:48 +0000
committergVisor bot <gvisor-bot@google.com>2021-09-02 22:19:48 +0000
commit2eebe530c712729af7866de15e3d6434d524f034 (patch)
treed485e6093a1736b24c572f6929b8308e487edcd0 /pkg
parentd9c9b0fb707d6887aef454488c16a515650e03ed (diff)
parent9149b2cefdb5883e41416aecea16fba4c5cd3ac1 (diff)
Merge release-20210823.0-48-g9149b2cef (automated)
Diffstat (limited to 'pkg')
-rw-r--r--pkg/sentry/socket/unix/transport/connectioned.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/sentry/socket/unix/transport/connectioned.go b/pkg/sentry/socket/unix/transport/connectioned.go
index 9a398c3b5..b3f0cf563 100644
--- a/pkg/sentry/socket/unix/transport/connectioned.go
+++ b/pkg/sentry/socket/unix/transport/connectioned.go
@@ -406,14 +406,15 @@ func (e *connectionedEndpoint) Listen(backlog int) *syserr.Error {
// Accept accepts a new connection.
func (e *connectionedEndpoint) Accept(peerAddr *tcpip.FullAddress) (Endpoint, *syserr.Error) {
e.Lock()
- defer e.Unlock()
if !e.Listening() {
+ e.Unlock()
return nil, syserr.ErrInvalidEndpointState
}
select {
case ne := <-e.acceptedChan:
+ e.Unlock()
if peerAddr != nil {
ne.Lock()
c := ne.connected
@@ -429,6 +430,7 @@ func (e *connectionedEndpoint) Accept(peerAddr *tcpip.FullAddress) (Endpoint, *s
return ne, nil
default:
+ e.Unlock()
// Nothing left.
return nil, syserr.ErrWouldBlock
}