summaryrefslogtreecommitdiffstats
path: root/net/net.c
diff options
context:
space:
mode:
authorMichael Roth <mdroth@linux.vnet.ibm.com>2013-02-06 18:25:48 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2013-02-07 13:13:39 -0600
commitb890492110ccdc943554231d40b67d29fef6af82 (patch)
tree617582fc881338226dea82508ad76b5f1b1d53e9 /net/net.c
parentecd8d4715ea33aa2c146a5047bacb031e86af599 (diff)
downloadhqemu-b890492110ccdc943554231d40b67d29fef6af82.zip
hqemu-b890492110ccdc943554231d40b67d29fef6af82.tar.gz
net: fix infinite loop on exit
1ceef9f27359cbe92ef124bf74de6f792e71f6fb added handling for cleaning up multiple queues in qemu_del_nic() for cases where multiqueue is in use. To determine the number of queues it looks at nic->conf->queues, then iterates through all the queues to cleanup the associated NetClientStates. If no queues are found, no NetClientStates are deleted. However, nic->conf->queues is only set when a peer is created via -netdev or netdev_add, and is otherwise 0. This causes us to spin in net_cleanup() if we attempt to shut down qemu before adding a host device. Since qemu_new_nic() unconditionally creates at least 1 queue/NetClientState at queue idx 0, make qemu_del_nic() always attempt to clean it up. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'net/net.c')
-rw-r--r--net/net.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/net.c b/net/net.c
index 9806862..f9e7136 100644
--- a/net/net.c
+++ b/net/net.c
@@ -351,7 +351,7 @@ void qemu_del_net_client(NetClientState *nc)
void qemu_del_nic(NICState *nic)
{
- int i, queues = nic->conf->queues;
+ int i, queues = MAX(nic->conf->queues, 1);
/* If this is a peer NIC and peer has already been deleted, free it now. */
if (nic->peer_deleted) {
OpenPOWER on IntegriCloud