mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Hold baseEndpoint.mu when calling baseEndpoint.Connected()
Connected must be called with baseEndpoint.mu locked. Updated method comment to include this precondition. Reported-by: syzbot+3ee57917033a3a23c8e0@syzkaller.appspotmail.com PiperOrigin-RevId: 432506434
This commit is contained in:
committed by
gVisor bot
parent
0b81a0d7b2
commit
b1ceabc884
@@ -519,6 +519,8 @@ func (e *connectionedEndpoint) State() uint32 {
|
||||
|
||||
// OnSetSendBufferSize implements tcpip.SocketOptionsHandler.OnSetSendBufferSize.
|
||||
func (e *connectionedEndpoint) OnSetSendBufferSize(v int64) (newSz int64) {
|
||||
e.Lock()
|
||||
defer e.Unlock()
|
||||
if e.Connected() {
|
||||
return e.baseEndpoint.connected.SetSendBufferSize(v)
|
||||
}
|
||||
|
||||
@@ -222,6 +222,8 @@ func (e *connectionlessEndpoint) State() uint32 {
|
||||
|
||||
// OnSetSendBufferSize implements tcpip.SocketOptionsHandler.OnSetSendBufferSize.
|
||||
func (e *connectionlessEndpoint) OnSetSendBufferSize(v int64) (newSz int64) {
|
||||
e.Lock()
|
||||
defer e.Unlock()
|
||||
if e.Connected() {
|
||||
return e.baseEndpoint.connected.SetSendBufferSize(v)
|
||||
}
|
||||
|
||||
@@ -813,6 +813,8 @@ func (e *baseEndpoint) ConnectedPasscred() bool {
|
||||
}
|
||||
|
||||
// Connected implements ConnectingEndpoint.Connected.
|
||||
//
|
||||
// Preconditions: e.mu must be held.
|
||||
func (e *baseEndpoint) Connected() bool {
|
||||
return e.receiver != nil && e.connected != nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user