Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Commit

Permalink
net: do not use atexit for cleanup
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
bonzini committed Jul 13, 2016
1 parent f6c2e66 commit 8caf911
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions vl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -4611,5 +4608,7 @@ int main(int argc, char **argv, char **envp)
tpm_cleanup();
#endif

net_cleanup();

return 0;
}

0 comments on commit 8caf911

Please sign in to comment.