Fix data race in tcp.GetSockOpt.

e.ID can't be read without holding e.mu. GetSockOpt was reading e.ID
when looking up OriginalDst without holding e.mu.

PiperOrigin-RevId: 330562293
This commit is contained in:
Bhasker Hariharan
2020-09-08 12:31:19 -07:00
committed by gVisor bot
parent d35f07b36a
commit 38cdb0579b
+2
View File
@@ -2019,8 +2019,10 @@ func (e *endpoint) GetSockOpt(opt tcpip.GettableSocketOption) *tcpip.Error {
e.UnlockUser()
case *tcpip.OriginalDestinationOption:
e.LockUser()
ipt := e.stack.IPTables()
addr, port, err := ipt.OriginalDst(e.ID)
e.UnlockUser()
if err != nil {
return err
}