diff mbox

[PATCHv2] vhost-user: delete chardev on cleanup

Message ID 20170124190258.14354-1-marcandre.lureau@redhat.com
State New
Headers show

Commit Message

Marc-André Lureau Jan. 24, 2017, 7:02 p.m. UTC
Remove the chardev implicitely when cleaning up the netdev. This
prevents from reusing the chardev since it would be in an incorrect
state with the slave.

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1256618

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 net/vhost-user.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Eric Blake Jan. 24, 2017, 7:16 p.m. UTC | #1
On 01/24/2017 01:02 PM, Marc-André Lureau wrote:
> Remove the chardev implicitely when cleaning up the netdev. This

s/implicitely/implicitly/

> prevents from reusing the chardev since it would be in an incorrect
> state with the slave.
> 
> Fixes:
> https://bugzilla.redhat.com/show_bug.cgi?id=1256618
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  net/vhost-user.c | 3 +++
>  1 file changed, 3 insertions(+)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> diff --git a/net/vhost-user.c b/net/vhost-user.c
> index 7aff77ee4a..179939f5c1 100644
> --- a/net/vhost-user.c
> +++ b/net/vhost-user.c
> @@ -151,7 +151,10 @@ static void vhost_user_cleanup(NetClientState *nc)
>          s->vhost_net = NULL;
>      }
>      if (nc->queue_index == 0) {
> +        CharDriverState *chr = qemu_chr_fe_get_driver(&s->chr);
> +
>          qemu_chr_fe_deinit(&s->chr);
> +        qemu_chr_delete(chr);
>      }
>  
>      qemu_purge_queued_packets(nc);
>
diff mbox

Patch

diff --git a/net/vhost-user.c b/net/vhost-user.c
index 7aff77ee4a..179939f5c1 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -151,7 +151,10 @@  static void vhost_user_cleanup(NetClientState *nc)
         s->vhost_net = NULL;
     }
     if (nc->queue_index == 0) {
+        CharDriverState *chr = qemu_chr_fe_get_driver(&s->chr);
+
         qemu_chr_fe_deinit(&s->chr);
+        qemu_chr_delete(chr);
     }
 
     qemu_purge_queued_packets(nc);