qemu-cr16/hw/net
Alexey Dobriyan 2c3e4e2de6 virtio-net: drop too short packets early
Reproducer from https://gitlab.com/qemu-project/qemu/-/issues/1451
creates small packet (1 segment, len = 10 == n->guest_hdr_len),
then destroys queue.

"if (n->host_hdr_len != n->guest_hdr_len)" is triggered, if body creates
zero length/zero segment packet as there is nothing after guest header.

qemu_sendv_packet_async() tries to send it.

slirp discards it because it is smaller than Ethernet header,
but returns 0 because tx hooks are supposed to return total length of data.

0 is propagated upwards and is interpreted as "packet has been sent"
which is terrible because queue is being destroyed, nobody is waiting for TX
to complete and assert it triggered.

Fix is discard such empty packets instead of sending them.

Length 1 packets will go via different codepath:

	virtqueue_push(q->tx_vq, elem, 0);
	virtio_notify(vdev, q->tx_vq);
	g_free(elem);

and aren't problematic.

Signed-off-by: Alexey Dobriyan <adobriyan@yandex-team.ru>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2024-06-04 15:14:26 +08:00
..
can hw, target: Add ResetType argument to hold and exit phase methods 2024-04-25 10:21:06 +01:00
fsl_etsec
rocker
allwinner-sun8i-emac.c
allwinner_emac.c
cadence_gem.c hw/net: cadence_gem: Fix MDIO_OP_xxx values 2024-01-05 22:28:54 +03:00
dp8393x.c
e1000.c hw, target: Add ResetType argument to hold and exit phase methods 2024-04-25 10:21:06 +01:00
e1000_common.h
e1000_regs.h
e1000e.c tap: Remove qemu_using_vnet_hdr() 2024-06-04 15:14:25 +08:00
e1000e_core.c e1000e: fix link state on resume 2024-03-12 19:28:32 +08:00
e1000e_core.h e1000e: fix link state on resume 2024-03-12 19:28:32 +08:00
e1000x_common.c
e1000x_common.h
e1000x_regs.h
eepro100.c
etraxfs_eth.c hw/net/etraxfs-eth: use qemu_configure_nic_device() 2024-02-02 16:23:47 +00:00
ftgmac100.c
i82596.c
i82596.h
igb.c tap: Remove qemu_using_vnet_hdr() 2024-06-04 15:14:25 +08:00
igb_common.h
igb_core.c igb: fix link state on resume 2024-03-12 19:28:31 +08:00
igb_core.h igb: fix link state on resume 2024-03-12 19:28:31 +08:00
igb_regs.h
igbvf.c hw, target: Add ResetType argument to hold and exit phase methods 2024-04-25 10:21:06 +01:00
imx_fec.c hw/misc/imx: Replace sprintf() by snprintf() 2024-04-25 12:48:12 +02:00
Kconfig
lan9118.c hw/net/lan9118: Fix overflow in MIL TX FIFO 2024-04-10 09:09:34 +02:00
lance.c
lasi_i82596.c hw/net/lasi_i82596: use qemu_create_nic_device() 2024-02-02 16:23:47 +00:00
mcf_fec.c
meson.build target/arm: fix exception syndrome for AArch32 bkpt insn 2024-02-02 18:56:32 +00:00
mipsnet.c
msf2-emac.c
mv88w8618_eth.c
ne2000-isa.c
ne2000-pci.c
ne2000.c
ne2000.h
net_rx_pkt.c
net_rx_pkt.h
net_tx_pkt.c tap: Remove qemu_using_vnet_hdr() 2024-06-04 15:14:25 +08:00
net_tx_pkt.h
npcm7xx_emc.c
npcm_gmac.c hw/net: GMAC Tx Implementation 2024-02-02 13:51:59 +00:00
opencores_eth.c
pcnet-pci.c
pcnet.c Avoid unaligned fetch in ladr_match() 2024-03-12 19:28:32 +08:00
pcnet.h
rtl8139.c
smc91c111.c hw/net/smc91c111: use qemu_configure_nic_device() 2024-02-02 16:23:47 +00:00
spapr_llan.c
stellaris_enet.c
sungem.c
sunhme.c
trace-events hw/net: GMAC Tx Implementation 2024-02-02 13:51:59 +00:00
trace.h
tulip.c hw/net/tulip: add chip status register values 2024-02-11 13:20:23 +01:00
tulip.h
vhost_net-stub.c
vhost_net.c vdpa-dev: Fix initialisation order to restore VDUSE compatibility 2024-03-26 14:21:26 +01:00
virtio-net.c virtio-net: drop too short packets early 2024-06-04 15:14:26 +08:00
vmware_utils.h
vmxnet3.c tap: Remove qemu_using_vnet_hdr() 2024-06-04 15:14:25 +08:00
vmxnet3.h
vmxnet3_defs.h
vmxnet_debug.h
xen_nic.c hw/net/xen_nic: Fix missing ERRP_GUARD() for error_prepend() 2024-03-09 18:51:45 +01:00
xgmac.c
xilinx_axienet.c
xilinx_ethlite.c