Files
Peter Maydell 467397ea30 net: pad packets to minimum length in qemu_receive_packet()
In commits like 969e50b61a ("net: Pad short frames to minimum size
before sending from SLiRP/TAP") we switched away from requiring
network devices to handle short frames to instead having the net core
code do the padding of short frames out to the ETH_ZLEN minimum size.
We then dropped the code for handling short frames from the network
devices in a series of commits like 140eae9c8f ("hw/net: e1000:
Remove the logic of padding short frames in the receive path").

This missed one route where the device's receive code can still see a
short frame: if the device is in loopback mode and it transmits a
short frame via the qemu_receive_packet() function, this will be fed
back into its own receive code without being padded.

Add the padding logic to qemu_receive_packet().

This fixes a buffer overrun which can be triggered in the
e1000_receive_iov() logic via the loopback code path.

Other devices that use qemu_receive_packet() to implement loopback
are cadence_gem, dp8393x, lan9118, msf2-emac, pcnet, rtl8139
and sungem.

Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3043
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit a01344d9d7)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-11-21 15:58:49 +03:00
..
2025-04-25 17:00:41 +02:00
2025-07-14 13:27:09 +08:00
2024-04-18 11:17:27 +02:00
2025-04-25 17:00:41 +02:00
2025-07-14 13:27:09 +08:00
2025-07-14 13:27:09 +08:00
2024-06-04 15:14:25 +08:00
2024-10-03 17:26:05 +03:00
2024-06-04 15:14:25 +08:00
2024-06-04 15:14:25 +08:00
2025-03-10 17:07:16 +08:00
2025-07-21 10:21:33 +08:00