virtio: regression fix
The following changes since commit a0d7215e339b61c7d7a7b3fcf754954d80d93eb8:
vhost-vdpa: do not cleanup the vdpa/vhost-net structures if peer nic is present (2023-06-26 09:50:00 -0400)
are available in the Git repository at:
https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
for you to fetch changes up to 0585e97f070014265e5ec3b28d27dcb963cde25b:
net/vhost-net: do not assert on null pointer return from tap_get_vhost_net() (2023-06-28 07:38:59 -0400)
----------------------------------------------------------------
virtio: regression fix
A regression was introduced in the last pull request. Fix it up.
----------------------------------------------------------------
Ani Sinha (1):
net/vhost-net: do not assert on null pointer return from tap_get_vhost_net()
hw/net/vhost_net.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
[PULL 1/1] net/vhost-net: do not assert on null pointer return from tap_get_vhost_net()
From: Ani Sinha <[email protected]>
When 'vhost=off' or no vhost specific options at all are passed for the tap net-device backend, tap_get_vhost_net() can return NULL. The function net_init_tap_one() does not call vhost_net_init() on such cases and therefore vhost_net pointer within the tap device state structure remains NULL. Hence, assertion here on a NULL pointer return from tap_get_vhost_net() would not be correct. Remove it and fix the crash generated by qemu upon initialization in the following call chain :
qdev_realize() -> pci_qdev_realize() -> virtio_device_realize() -> virtio_bus_device_plugged() -> virtio_net_get_features() -> get_vhost_net()
Report: <[email protected]>
Message-Id: <[email protected]>
--- hw/net/vhost_net.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
hw/net/vhost_net.c +6 -1
@@ -507,7 +507,12 @@ VHostNetState *get_vhost_net(NetClientState *nc)switch (nc->info->type) {case NET_CLIENT_DRIVER_TAP : vhost_net =tap_get_vhost_net (nc); -assert (vhost_net); +/* +* tap_get_vhost_net() can return NULL if a tap net-device backend is +* created with 'vhost=off' option, 'vhostforce=off' or no vhost or +* vhostforce or vhostfd options at all. Please see net_init_tap_one(). +* Hence, we omit the assertion here. +*/ break ;#ifdef CONFIG_VHOST_NET_USER case NET_CLIENT_DRIVER_VHOST_USER :
Signature · 1 line
MST
Quoted 9 lines · Michael S. Tsirkin
The following changes since commit
a0d7215e339b61c7d7a7b3fcf754954d80d93eb8:vhost-vdpa: do not cleanup the vdpa/vhost-net structures if peer nic is present (2023-06-26 09:50:00 -0400)
are available in the Git repository at:
https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
for you to fetch changes up to
0585e97f070014265e5ec3b28d27dcb963cde25b:
ca3fcdeeeef56f46a7ac7b2408eda608d59be6f1 now - added reviewed by tags.
Quoted 16 lines
net/vhost-net: do not assert on null pointer return fromtap_get_vhost_net()(2023-06-28 07:38:59 -0400)----------------------------------------------------------------
virtio: regression fixA regression was introduced in the last pull request. Fix it up.
Signed-off-by Michael S. Tsirkin <[email protected]>----------------------------------------------------------------
Ani Sinha (1):
net/vhost-net: do not assert on null pointer return fromtap_get_vhost_net()hw/net/vhost_net.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
Richard Henderson
AppliedQuoted 10 lines · Michael S. Tsirkin
The following changes since commit
a0d7215e339b61c7d7a7b3fcf754954d80d93eb8:vhost-vdpa: do not cleanup the vdpa/vhost-net structures if peer nic is present (2023-06-26 09:50:00 -0400)
are available in the Git repository at:
https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
for you to fetch changes up to
0585e97f070014265e5ec3b28d27dcb963cde25b:
Quoted 8 lines
net/vhost-net: do not assert on null pointer return fromtap_get_vhost_net()(2023-06-28 07:38:59 -0400)----------------------------------------------------------------
virtio: regression fixA regression was introduced in the last pull request. Fix it up.
Signed-off-by Michael S. Tsirkin<[email protected]>
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/8.1 as appropriate.
r~