Fix ipv4.endpoint.AddAndAcquirePermanentAddress() to write lock endpoint mutex.

Fixes #7951

PiperOrigin-RevId: 598068487
This commit is contained in:
Ayush Ranjan
2024-01-12 22:23:12 -08:00
committed by gVisor bot
parent c7c534826e
commit 5eaa66a2ed
+3 -3
View File
@@ -1362,8 +1362,8 @@ func (e *endpoint) Close() {
// AddAndAcquirePermanentAddress implements stack.AddressableEndpoint.
func (e *endpoint) AddAndAcquirePermanentAddress(addr tcpip.AddressWithPrefix, properties stack.AddressProperties) (stack.AddressEndpoint, tcpip.Error) {
e.mu.RLock()
defer e.mu.RUnlock()
e.mu.Lock()
defer e.mu.Unlock()
ep, err := e.addressableEndpointState.AddAndAcquireAddress(addr, properties, stack.Permanent)
if err == nil {
@@ -1374,7 +1374,7 @@ func (e *endpoint) AddAndAcquirePermanentAddress(addr tcpip.AddressWithPrefix, p
// sendQueuedReports sends queued igmp reports.
//
// +checklocksread:e.mu
// +checklocks:e.mu
// +checklocksalias:e.igmp.ep.mu=e.mu
func (e *endpoint) sendQueuedReports() {
e.igmp.sendQueuedReports()