vhost: Added pad cleanup if vnet_hdr is not present.
authorAndrew Melnychenko <andrew@daynix.com>
Mon, 15 Jan 2024 19:48:40 +0000 (21:48 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 19 Mar 2024 06:45:49 +0000 (02:45 -0400)
commitf6baca2d32ead51b10e15f1eef812d7c6a7b9a40
tree301e9d942436f868eb632538192b71b5375f68fa
parente8f897f4afef0031fe618a8e94127a0934896aba
vhost: Added pad cleanup if vnet_hdr is not present.

When the Qemu launched with vhost but without tap vnet_hdr,
vhost tries to copy vnet_hdr from socket iter with size 0
to the page that may contain some trash.
That trash can be interpreted as unpredictable values for
vnet_hdr.
That leads to dropping some packets and in some cases to
stalling vhost routine when the vhost_net tries to process
packets and fails in a loop.

Qemu options:
  -netdev tap,vhost=on,vnet_hdr=off,...

Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
Message-Id: <20240115194840.1183077-1-andrew@daynix.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vhost/net.c