mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix data race in netlink send buffer size
PiperOrigin-RevId: 239221041 Change-Id: Icc19e32a00fa89167447ab2f45e90dcfd61bea04
This commit is contained in:
committed by
Shentubot
parent
928809fa7d
commit
7b33df6845
@@ -291,6 +291,8 @@ func (s *Socket) GetSockOpt(t *kernel.Task, level int, name int, outLen int) (in
|
||||
if outLen < sizeOfInt32 {
|
||||
return nil, syserr.ErrInvalidArgument
|
||||
}
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
return int32(s.sendBufferSize), nil
|
||||
|
||||
case linux.SO_RCVBUF:
|
||||
@@ -335,7 +337,9 @@ func (s *Socket) SetSockOpt(t *kernel.Task, level int, name int, opt []byte) *sy
|
||||
} else if size > maxSendBufferSize {
|
||||
size = maxSendBufferSize
|
||||
}
|
||||
s.mu.Lock()
|
||||
s.sendBufferSize = size
|
||||
s.mu.Unlock()
|
||||
return nil
|
||||
case linux.SO_RCVBUF:
|
||||
if len(opt) < sizeOfInt32 {
|
||||
|
||||
Reference in New Issue
Block a user