diff options
author | Ghanan Gowripalan <ghanan@google.com> | 2021-06-07 19:56:04 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-06-07 19:58:52 -0700 |
commit | 77930d0d5ff993d3c870a2237c09193433c89429 (patch) | |
tree | b4ba01a78b2a4869bc7c8b47355d47fbd19add0a /pkg/tcpip | |
parent | e710aceb5c68271bea02c848c016f8b4db935010 (diff) |
Exclusively lock IPv6 EP when modifying addresses
...as address add/removal updates multicast group memberships and NDP
state.
This partially reverts the change made to the IPv6 endpoint in
https://github.com/google/gvisor/commit/ebebb3059f7c5dbe42af85715f1c51c.
PiperOrigin-RevId: 378061726
Diffstat (limited to 'pkg/tcpip')
-rw-r--r-- | pkg/tcpip/network/ipv6/ipv6.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/tcpip/network/ipv6/ipv6.go b/pkg/tcpip/network/ipv6/ipv6.go index 981be7275..12763add6 100644 --- a/pkg/tcpip/network/ipv6/ipv6.go +++ b/pkg/tcpip/network/ipv6/ipv6.go @@ -1627,8 +1627,8 @@ func (e *endpoint) NetworkProtocolNumber() tcpip.NetworkProtocolNumber { func (e *endpoint) AddAndAcquirePermanentAddress(addr tcpip.AddressWithPrefix, peb stack.PrimaryEndpointBehavior, configType stack.AddressConfigType, deprecated bool) (stack.AddressEndpoint, tcpip.Error) { // TODO(b/169350103): add checks here after making sure we no longer receive // an empty address. - e.mu.RLock() - defer e.mu.RUnlock() + e.mu.Lock() + defer e.mu.Unlock() return e.addAndAcquirePermanentAddressLocked(addr, peb, configType, deprecated) } @@ -1669,8 +1669,8 @@ func (e *endpoint) addAndAcquirePermanentAddressLocked(addr tcpip.AddressWithPre // RemovePermanentAddress implements stack.AddressableEndpoint. func (e *endpoint) RemovePermanentAddress(addr tcpip.Address) tcpip.Error { - e.mu.RLock() - defer e.mu.RUnlock() + e.mu.Lock() + defer e.mu.Unlock() addressEndpoint := e.getAddressRLocked(addr) if addressEndpoint == nil || !addressEndpoint.GetKind().IsPermanent() { |