Don't switch to using the packet mmap endpoint for zero length requests.

This matches linux's behavior.

Reported-by: syzbot+31f4b63198c23c53c6e2@syzkaller.appspotmail.com
Reported-by: syzbot+e19f276e27cccbbecd0e@syzkaller.appspotmail.com
PiperOrigin-RevId: 724032784
This commit is contained in:
Lucas Manning
2025-02-06 12:34:46 -08:00
committed by gVisor bot
parent d8518f2991
commit 213917f3ea
2 changed files with 31 additions and 3 deletions
+5 -3
View File
@@ -2745,10 +2745,12 @@ func setSockOptPacket(t *kernel.Task, s socket.Socket, ep commonEndpoint, name i
pme = &packetmmap.Endpoint{}
}
opts := ep.GetPacketMMapOpts(&req, true /* isRx */)
if err := pme.Init(t, opts); err != nil {
return syserr.FromError(err)
if opts.Req.TpFrameNr != 0 || opts.Req.TpBlockNr != 0 {
if err := pme.Init(t, opts); err != nil {
return syserr.FromError(err)
}
ep.SetPacketMMapEndpoint(pme)
}
ep.SetPacketMMapEndpoint(pme)
} else {
return syserr.ErrNotSupported
}