Skip to contentSkip to conversation

vhost-user: delete chardev on cleanup

PATCH In review Marc-André Lureau 2 participants 2 messages Jan 24, 2017 Networking

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 vhost-user: delete chardev on cleanup

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

---
 net/vhost-user.c | 3 +++
 1 file changed, 3 insertions(+)
net/vhost-user.c +3 -0
index 7aff77ee4a..179939f5c1 100644
@@ -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);
Signature · 1 line
2.11.0.295.gd7dffce1c
Reviewed-by on v2 1/1
#1 lore raw
Quoted 1 line · Marc-André Lureau

Remove the chardev implicitely when cleaning up the netdev. This

s/implicitely/implicitly/

Quoted 10 lines

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

---
 net/vhost-user.c | 3 +++
 1 file changed, 3 insertions(+)
Quoted 17 lines
net/vhost-user.c +3 -0
index 7aff77ee4a..179939f5c1 100644
@@ -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);
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org