qemu-cr16/net
Peter Maydell a01344d9d7 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>
2025-11-14 09:59:55 +08:00
..
can qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
af-xdp.c net/af-xdp: Support pinned map path for AF_XDP sockets 2025-07-15 10:26:55 +08:00
announce.c qapi net: Elide redundant has_FOO in generated C 2022-12-14 20:04:47 +01:00
checksum.c net: checksum: Convert data to void * 2024-11-25 13:59:50 +08:00
clients.h net: Add passt network backend 2025-07-14 13:27:09 +08:00
colo-compare.c char: rename CharBackend->CharFrontend 2025-10-28 14:49:52 +01:00
colo-compare.h Add the function of colo_compare_cleanup 2021-06-11 10:30:13 +08:00
colo-stubs.c colo: move stubs out of stubs/ 2024-04-18 11:17:27 +02:00
colo.c net/colo.c: Fix the pointer issue reported by Coverity. 2022-09-02 10:22:39 +08:00
colo.h net/colo.c: Fix the pointer issue reported by Coverity. 2022-09-02 10:22:39 +08:00
dgram.c util: drop qemu_socket_try_set_nonblock() 2025-09-19 12:46:07 +01:00
dump.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
eth.c net/eth: Clean up local variable shadowing 2023-09-29 10:07:16 +02:00
filter-buffer.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
filter-mirror.c char: rename CharBackend->CharFrontend 2025-10-28 14:49:52 +01:00
filter-replay.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
filter-rewriter.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
filter.c qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
hub.c net/hub: make net_hub_port_cleanup idempotent 2025-11-14 09:59:54 +08:00
hub.h net: Remove deprecated [hub_id name] tuple of 'hostfwd_add' / 'hostfwd_remove' 2020-03-09 18:44:04 +00:00
l2tpv3.c util: drop qemu_socket_set_nonblock() 2025-09-19 12:46:07 +01:00
meson.build net: Add passt network backend 2025-07-14 13:27:09 +08:00
net-hmp-cmds.c qapi: Move include/qapi/qmp/ to include/qobject/ 2025-02-10 15:33:16 +01:00
net.c net: pad packets to minimum length in qemu_receive_packet() 2025-11-14 09:59:55 +08:00
netmap.c net: bundle all offloads in a single struct 2025-10-04 10:50:36 -04:00
passt.c char: rename CharBackend->CharFrontend 2025-10-28 14:49:52 +01:00
queue.c net: Remove deadcode 2024-10-03 17:26:05 +03:00
slirp.c char: rename CharBackend->CharFrontend 2025-10-28 14:49:52 +01:00
socket.c util: drop qemu_socket_try_set_nonblock() 2025-09-19 12:46:07 +01:00
stream.c net/stream: remove deprecated 'reconnect' option 2025-10-28 16:49:34 +03:00
stream_data.c util: drop qemu_socket_try_set_nonblock() 2025-09-19 12:46:07 +01:00
stream_data.h net: Refactor stream logic for reuse in '-net passt' 2025-07-14 13:27:09 +08:00
tap-bsd.c net: implement tunnel probing 2025-10-04 10:51:02 -04:00
tap-linux.c net: implement UDP tunnel features offloading 2025-10-04 10:51:09 -04:00
tap-linux.h net: implement tunnel probing 2025-10-04 10:51:02 -04:00
tap-solaris.c net: implement tunnel probing 2025-10-04 10:51:02 -04:00
tap-stub.c net: implement tunnel probing 2025-10-04 10:51:02 -04:00
tap-win32.c net: Add get_vhost_net callback to NetClientInfo 2025-07-14 13:27:09 +08:00
tap.c net: implement UDP tunnel features offloading 2025-10-04 10:51:09 -04:00
tap_int.h net: implement tunnel probing 2025-10-04 10:51:02 -04:00
trace-events vdpa: add trace event for vhost_vdpa_net_load_mq 2024-03-12 17:56:55 -04:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
util.c
util.h Replace config-time define HOST_WORDS_BIGENDIAN 2022-04-06 10:50:37 +02:00
vde.c net: introduce qemu_set_info_str() function 2022-10-28 13:28:52 +08:00
vhost-user-stub.c net: Add save_acked_features callback to vhost_net 2025-07-14 13:27:09 +08:00
vhost-user.c char: rename CharBackend->CharFrontend 2025-10-28 14:49:52 +01:00
vhost-vdpa-stub.c vhost-net-vdpa: add stubs for when no virtio-net device is present 2022-07-20 16:58:08 +08:00
vhost-vdpa.c net/vdpa: fix potential fd leak in net_init_vhost_vdpa() 2025-08-01 10:23:50 -04:00
vmnet-bridged.m net/vmnet: Drop ifdef for macOS versions older than 12.0 2024-07-02 06:58:48 +02:00
vmnet-common.m error: Strip trailing '\n' from an error string argument 2025-03-19 07:53:26 +01:00
vmnet-host.c net/vmnet: Drop ifdef for macOS versions older than 12.0 2024-07-02 06:58:48 +02:00
vmnet-shared.c net/vmnet: Drop ifdef for macOS versions older than 12.0 2024-07-02 06:58:48 +02:00
vmnet_int.h vmnet: stop recieving events when VM is stopped 2023-02-17 13:31:33 +08:00