* [PULL 0/1] virtio: regression fix
@ 2023-06-28 11:41 Michael S. Tsirkin
2023-06-28 11:41 ` [PULL 1/1] net/vhost-net: do not assert on null pointer return from tap_get_vhost_net() Michael S. Tsirkin
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2023-06-28 11:41 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell
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.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
----------------------------------------------------------------
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(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PULL 1/1] net/vhost-net: do not assert on null pointer return from tap_get_vhost_net()
2023-06-28 11:41 [PULL 0/1] virtio: regression fix Michael S. Tsirkin
@ 2023-06-28 11:41 ` Michael S. Tsirkin
2023-06-28 11:54 ` [PULL 0/1] virtio: regression fix Michael S. Tsirkin
2023-06-28 15:29 ` Richard Henderson
2 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2023-06-28 11:41 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Ani Sinha, Cédric Le Goater, Jason Wang
From: Ani Sinha <anisinha@redhat.com>
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()
Fixes: 0e994668d00c9c ("vhost_net: add an assertion for TAP client backends")
Reported-by: Cédric Le Goater <clg@redhat.com>
Report: <abab7a71-216d-b103-fa47-70bdf9dc0080@redhat.com>
Signed-off-by: Ani Sinha <anisinha@redhat.com>
Message-Id: <20230628112804.36676-1-anisinha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/net/vhost_net.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 6db23ca323..6b958d6363 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -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:
--
MST
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PULL 0/1] virtio: regression fix
2023-06-28 11:41 [PULL 0/1] virtio: regression fix Michael S. Tsirkin
2023-06-28 11:41 ` [PULL 1/1] net/vhost-net: do not assert on null pointer return from tap_get_vhost_net() Michael S. Tsirkin
@ 2023-06-28 11:54 ` Michael S. Tsirkin
2023-06-28 15:29 ` Richard Henderson
2 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2023-06-28 11:54 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell
On Wed, Jun 28, 2023 at 07:41:34AM -0400, Michael S. Tsirkin wrote:
> 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.
> 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.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
> ----------------------------------------------------------------
> 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(-)
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PULL 0/1] virtio: regression fix
2023-06-28 11:41 [PULL 0/1] virtio: regression fix Michael S. Tsirkin
2023-06-28 11:41 ` [PULL 1/1] net/vhost-net: do not assert on null pointer return from tap_get_vhost_net() Michael S. Tsirkin
2023-06-28 11:54 ` [PULL 0/1] virtio: regression fix Michael S. Tsirkin
@ 2023-06-28 15:29 ` Richard Henderson
2 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2023-06-28 15:29 UTC (permalink / raw)
To: Michael S. Tsirkin, qemu-devel; +Cc: Peter Maydell
On 6/28/23 13:41, Michael S. Tsirkin wrote:
> 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.
>
> Signed-off-by: Michael S. Tsirkin<mst@redhat.com>
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/8.1 as appropriate.
r~
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-06-28 15:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-28 11:41 [PULL 0/1] virtio: regression fix Michael S. Tsirkin
2023-06-28 11:41 ` [PULL 1/1] net/vhost-net: do not assert on null pointer return from tap_get_vhost_net() Michael S. Tsirkin
2023-06-28 11:54 ` [PULL 0/1] virtio: regression fix Michael S. Tsirkin
2023-06-28 15:29 ` Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).