vhost-user: delete chardev on cleanup

Remove the chardev implicitly when cleaning up the netdev. This
prevents from reusing the chardev since it would be in an incorrect
state with the slave.

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

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Marc-André Lureau 2017-01-24 23:02:58 +04:00 committed by Michael S. Tsirkin
parent d56ec1e98c
commit e0b283e7c5
1 changed files with 3 additions and 0 deletions

View File

@ -151,7 +151,10 @@ static void vhost_user_cleanup(NetClientState *nc)
s->vhost_net = NULL;
}
if (nc->queue_index == 0) {
Chardev *chr = qemu_chr_fe_get_driver(&s->chr);
qemu_chr_fe_deinit(&s->chr);
qemu_chr_delete(chr);
}
qemu_purge_queued_packets(nc);