[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] net: cleanup before character devices
From: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] [PATCH] net: cleanup before character devices |
Date: |
Fri, 8 Jul 2016 17:42:30 +0200 |
Hi
On Fri, Jul 8, 2016 at 5:27 PM, Paolo Bonzini <address@hidden> wrote:
> Otherwise, vhost-user causes a use-after-free.
>
> Signed-off-by: Paolo Bonzini <address@hidden>
Sorry I didn't see the criticals in make check after my patch...
Thanks for fixing it this quickly
> ---
> vl.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index d0b9ff9..005162d 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -4327,9 +4327,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);
> @@ -4596,6 +4593,9 @@ int main(int argc, char **argv, char **envp)
> #ifdef CONFIG_TPM
> tpm_cleanup();
> #endif
> +
> + /* vhost-user must be cleaned up before chardevs. */
> + net_cleanup();
Alternatively, if it's better to keep the atexit(net_cleanup), we
could have atexit(qemu_chr_cleanup) here, so it's only called on
normal exit and after net_cleanup.
Reviewed-by: Marc-André Lureau <address@hidden>
> qemu_chr_cleanup();
>
> return 0;
> --
> 1.8.3.1
>
>
--
Marc-André Lureau