mirror_qemu/net
David Woodhouse 84f85eb95f net: do not delete nics in net_cleanup()
In net_cleanup() we only need to delete the netdevs, as those may have
state which outlives Qemu when it exits, and thus may actually need to
be cleaned up on exit.

The nics, on the other hand, are owned by the device which created them.
Most devices don't bother to clean up on exit because they don't have
any state which will outlive Qemu... but XenBus devices do need to clean
up their nodes in XenStore, and do have an exit handler to delete them.

When the XenBus exit handler destroys the xen-net-device, it attempts
to delete its nic after net_cleanup() had already done so. And crashes.

Fix this by only deleting netdevs as we walk the list. As the comment
notes, we can't use QTAILQ_FOREACH_SAFE() as each deletion may remove
*multiple* entries, including the "safely" saved 'next' pointer. But
we can store the *previous* entry, since nics are safe.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2023-11-21 15:42:34 +08:00
..
can meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
af-xdp.c net: add initial support for AF_XDP network backend 2023-09-18 14:36:13 +08:00
announce.c qapi net: Elide redundant has_FOO in generated C 2022-12-14 20:04:47 +01:00
checksum.c misc/other: spelling fixes 2023-09-08 13:08:52 +03:00
clients.h net: add initial support for AF_XDP network backend 2023-09-18 14:36:13 +08:00
colo-compare.c qapi: Use returned bool to check for failure (again) 2022-12-14 16:19:35 +01:00
colo-compare.h Add the function of colo_compare_cleanup 2021-06-11 10:30:13 +08: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 win32: replace closesocket() with close() wrapper 2023-03-13 15:39:31 +04:00
dump.c net/dump: Avoid variable length array 2023-09-18 14:36:13 +08:00
eth.c net/eth: Clean up local variable shadowing 2023-09-29 10:07:16 +02:00
filter-buffer.c netfilter: Use class properties 2020-12-15 10:02:07 -05:00
filter-mirror.c net/filter: Optimize filter_send to coroutine 2022-02-14 11:50:44 +08:00
filter-replay.c hw: Do not include qemu/log.h if it is not necessary 2021-05-02 17:24:50 +02:00
filter-rewriter.c net/colo: Fix a "double free" crash to clear the conn_list 2022-07-20 16:58:08 +08:00
filter.c misc/other: spelling fixes 2023-09-08 13:08:52 +03:00
hub.c qapi net: Elide redundant has_FOO in generated C 2022-12-14 20:04:47 +01: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 net: Increase L2TPv3 buffer to fit jumboframes 2023-02-17 13:31:33 +08:00
meson.build net: add initial support for AF_XDP network backend 2023-09-18 14:36:13 +08:00
net-hmp-cmds.c net: Move hmp_info_network() to net-hmp-cmds.c 2023-02-04 07:56:54 +01:00
net.c net: do not delete nics in net_cleanup() 2023-11-21 15:42:34 +08:00
netmap.c tap: Add USO support to tap device. 2023-09-18 14:36:13 +08:00
queue.c net: introduce qemu_receive_packet() 2021-03-15 16:41:22 +08:00
slirp.c migration: Use VMSTATE_INSTANCE_ID_ANY for slirp 2023-11-01 16:13:58 +01:00
socket.c net: socket: remove net_init_socket() 2023-07-07 16:35:12 +08:00
stream.c net: stream: add a new option to automatically reconnect 2023-02-17 13:31:33 +08:00
tap-bsd.c tap: Add check for USO features 2023-09-18 14:36:13 +08:00
tap-linux.c tap: Add check for USO features 2023-09-18 14:36:13 +08:00
tap-linux.h tap: Add USO support to tap device. 2023-09-18 14:36:13 +08:00
tap-solaris.c tap: Add check for USO features 2023-09-18 14:36:13 +08:00
tap-stub.c tap: Add check for USO features 2023-09-18 14:36:13 +08:00
tap-win32.c tap: Add USO support to tap device. 2023-09-18 14:36:13 +08:00
tap.c net/tap: Avoid variable-length array 2023-09-18 14:36:13 +08:00
tap_int.h tap: Add check for USO features 2023-09-18 14:36:13 +08:00
trace-events net/colo.c: Fix the pointer issue reported by Coverity. 2022-09-02 10:22:39 +08:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
util.c net: Clean up includes 2016-02-04 17:41:30 +00:00
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 vhost-net-user: add stubs for when no virtio-net device is present 2019-02-21 12:28:01 -05:00
vhost-user.c hw/char: Have FEWatchFunc handlers return G_SOURCE_CONTINUE/REMOVE 2023-08-31 19:47:43 +02: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 vdpa: Allow VIRTIO_NET_F_RSS in SVQ 2023-11-07 03:39:11 -05:00
vmnet-bridged.m cocoa: Fix warnings about invalid prototype declarations 2023-06-13 11:28:58 +02:00
vmnet-common.m vmnet: stop recieving events when VM is stopped 2023-02-17 13:31:33 +08:00
vmnet-host.c qapi net: Elide redundant has_FOO in generated C 2022-12-14 20:04:47 +01:00
vmnet-shared.c qapi net: Elide redundant has_FOO in generated C 2022-12-14 20:04:47 +01:00
vmnet_int.h vmnet: stop recieving events when VM is stopped 2023-02-17 13:31:33 +08:00