mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Unlock fdbased.endpoint.mu before fdbased.endpoint.Wait().
This prevents the deadlock described in #11456. Fixes #11456. PiperOrigin-RevId: 725352718
This commit is contained in:
@@ -422,17 +422,19 @@ func isSocketFD(fd int) (bool, error) {
|
||||
// Attach implements stack.LinkEndpoint.Attach.
|
||||
func (e *endpoint) Attach(dispatcher stack.NetworkDispatcher) {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
|
||||
// nil means the NIC is being removed.
|
||||
if dispatcher == nil && e.dispatcher != nil {
|
||||
for _, dispatcher := range e.inboundDispatchers {
|
||||
dispatcher.Stop()
|
||||
}
|
||||
e.Wait()
|
||||
e.dispatcher = nil
|
||||
// NOTE(gvisor.dev/issue/11456): Unlock e.mu before e.Wait().
|
||||
e.mu.Unlock()
|
||||
e.Wait()
|
||||
return
|
||||
}
|
||||
defer e.mu.Unlock()
|
||||
if dispatcher != nil && e.dispatcher == nil {
|
||||
e.dispatcher = dispatcher
|
||||
// Link endpoints are not savable. When transportation endpoints are
|
||||
|
||||
Reference in New Issue
Block a user