Skip to content

Commit

Permalink
vhost-user: disable chardev handlers on close
Browse files Browse the repository at this point in the history
This otherwise causes a use-after-free if network backend cleanup
is performed before character device cleanup.

Cc: Marc-André Lureau <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
bonzini committed Jun 29, 2016
1 parent 634d39b commit 25f0d2a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions net/vhost-user.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 25f0d2a

Please sign in to comment.