Skip to contentSkip to conversation

vhost-user: disable chardev handlers on close

PATCH New Paolo Bonzini 1 participant 2 messages Jun 29, 2016 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vhost-user: disable chardev handlers on close

This otherwise causes a use-after-free if network backend cleanup is performed before character device cleanup.

Cc Marc-André Lureau <[email protected]>

---
I'm including this in the pull request too.

 net/vhost-user.c | 5 +++++
 1 file changed, 5 insertions(+)
net/vhost-user.c +5 -0
index 636899a..92f4cfd 100644
@@ -151,6 +151,11 @@ static void vhost_user_cleanup(NetClientState *nc)
         vhost_net_cleanup(s->vhost_net);
         s->vhost_net = NULL;
     }
+    if (s->chr) {
+        qemu_chr_add_handlers(s->chr, NULL, NULL, NULL, NULL);
+        qemu_chr_fe_release(s->chr);
+        s->chr = NULL;
+    }
 
     qemu_purge_queued_packets(nc);
 }
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 vhost-user: disable chardev handlers on close

This otherwise causes a use-after-free if network backend cleanup is performed before character device cleanup.

Cc Marc-André Lureau <[email protected]>
---
 net/vhost-user.c | 5 +++++
 1 file changed, 5 insertions(+)
net/vhost-user.c +5 -0
index 636899a..92f4cfd 100644
@@ -151,6 +151,11 @@ static void vhost_user_cleanup(NetClientState *nc)
         vhost_net_cleanup(s->vhost_net);
         s->vhost_net = NULL;
     }
+    if (s->chr) {
+        qemu_chr_add_handlers(s->chr, NULL, NULL, NULL, NULL);
+        qemu_chr_fe_release(s->chr);
+        s->chr = NULL;
+    }
 
     qemu_purge_queued_packets(nc);
 }
Signature · 1 line
1.8.3.1