On Wed, 4 Nov 2026 at 14:01, Marcelo Manzo <[email protected]> wrote: > > The RX path clamped the payload copied into each descriptor only > against the whole RING_BUF_SIZE register (whose upper half is the ring > size, not a buffer length) and against the size of the rx_packet > staging buffer. It did not account for the status block and 2 byte pad > that precede the payload, nor for the 4 byte CRC that is added to the > reported BUFLENGTH when CRC forwarding is enabled. The BUFLENGTH > written to the descriptor could therefore exceed the buffer the guest > supplied. > > Clamp the payload to the guest's buffer size minus the status block, > pad and CRC. BUFLENGTH is then at most the buffer size, which is at > most MAX_FRAME_SIZE, so it fits its 12 bit field by construction. > (It cannot overflow today, because receive() drops frames larger than > MAX_PACKET_SIZE, but nothing in the descriptor code made that obvious.) > > This also fixes a hang: with a buffer size of 0 the old code copied > zero bytes per iteration and never made progress through the frame. > Treat a buffer too small to hold any payload as a guest error and drop > the frame. > > Resolves: Coverity CID 1690161 > Signed-off-by: Marcelo Manzo <[email protected]> > ---
Applied to target-arm.next, thanks. -- PMM
