qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 11/14] net: do not use atexit for cleanup


From: Paolo Bonzini
Subject: [Qemu-devel] [PULL 11/14] net: do not use atexit for cleanup
Date: Wed, 13 Jul 2016 15:26:29 +0200

This will be necessary in the next patch, which stops using atexit for
character devices; without it, vhost-user and the redirector filter
will cause a use-after-free.  Relying on the ordering of atexit calls
is also brittle, even now that both the network and chardev
subsystems are using atexit.

Signed-off-by: Paolo Bonzini <address@hidden>
---
 vl.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/vl.c b/vl.c
index 356713e..cad4da2 100644
--- a/vl.c
+++ b/vl.c
@@ -4345,9 +4345,6 @@ int main(int argc, char **argv, char **envp)
         qemu_opts_del(icount_opts);
     }
 
-    /* clean up network at qemu process termination */
-    atexit(&net_cleanup);
-
     if (default_net) {
         QemuOptsList *net = qemu_find_opts("net");
         qemu_opts_set(net, NULL, "type", "nic", &error_abort);
@@ -4611,5 +4608,7 @@ int main(int argc, char **argv, char **envp)
     tpm_cleanup();
 #endif
 
+    net_cleanup();
+
     return 0;
 }
-- 
1.8.3.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]