mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Do not read-lock NIC recursively
A deadlock may occur if a write lock on a RWMutex is blocked between nested read lock attempts as the inner read lock attempt will be blocked in this scenario. Example (T1 and T2 are differnt goroutines): T1: obtain read-lock T2: attempt write-lock (blocks) T1: attempt inner/nested read-lock (blocks) Here we can see that T1 and T2 are deadlocked. Tests: Existing tests pass. PiperOrigin-RevId: 298426678
This commit is contained in:
committed by
gVisor bot
parent
f03e19d575
commit
8821a7104f
@@ -451,7 +451,7 @@ func (n *NIC) primaryIPv6Endpoint(remoteAddr tcpip.Address) *referencedNetworkEn
|
||||
cs := make([]ipv6AddrCandidate, 0, len(primaryAddrs))
|
||||
for _, r := range primaryAddrs {
|
||||
// If r is not valid for outgoing connections, it is not a valid endpoint.
|
||||
if !r.isValidForOutgoing() {
|
||||
if !r.isValidForOutgoingRLocked() {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user