mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Don't hold baseEndpoint.mu when calling receiver.Recv.
We only need baseEndpoint.mu to read e.receiver, which we copy before calling Recv() on in. Reported-by: syzbot+f8566b86ff7c2613d8ce@syzkaller.appspotmail.com Reported-by: syzbot+9f8368319cf3570ea45b@syzkaller.appspotmail.com PiperOrigin-RevId: 530970638
This commit is contained in:
committed by
gVisor bot
parent
dd9a3d10bd
commit
a7e1fe92f5
@@ -870,15 +870,14 @@ func (e *baseEndpoint) Connected() bool {
|
||||
// RecvMsg reads data and a control message from the endpoint.
|
||||
func (e *baseEndpoint) RecvMsg(ctx context.Context, data [][]byte, creds bool, numRights int, peek bool, addr *Address) (int64, int64, ControlMessages, bool, func(), *syserr.Error) {
|
||||
e.Lock()
|
||||
|
||||
receiver := e.receiver
|
||||
e.Unlock()
|
||||
|
||||
if receiver == nil {
|
||||
e.Unlock()
|
||||
return 0, 0, ControlMessages{}, false, nil, syserr.ErrNotConnected
|
||||
}
|
||||
|
||||
recvLen, msgLen, cms, cmt, a, notify, err := receiver.Recv(ctx, data, creds, numRights, peek)
|
||||
e.Unlock()
|
||||
if err != nil {
|
||||
return 0, 0, ControlMessages{}, false, nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user