aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vhost/net.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2011-07-20 06:41:31 -0400
committerMichael S. Tsirkin <mst@redhat.com>2011-07-21 03:23:31 -0400
commitc047e5f3170c2595e66ed67f87cec01afd717212 (patch)
tree5e48ab84e14e4380b8409e646f086143c1769f5d /drivers/vhost/net.c
parentb834226b04d6fb51178a64e98872856986c71474 (diff)
vhost-net: update used ring on backend change
On backend change, we flushed out outstanding skbs but forgot to update the used ring, so that done entries were left in the ubuf_info ring. As a result we lose heads or complete incorrect ones, crashing the guest or leaking memory. Fix by updating the used ring. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost/net.c')
-rw-r--r--drivers/vhost/net.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 70ac60437d17..248b25008d1a 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -711,8 +711,12 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
711 711
712 mutex_unlock(&vq->mutex); 712 mutex_unlock(&vq->mutex);
713 713
714 if (oldubufs) 714 if (oldubufs) {
715 vhost_ubuf_put_and_wait(oldubufs); 715 vhost_ubuf_put_and_wait(oldubufs);
716 mutex_lock(&vq->mutex);
717 vhost_zerocopy_signal_used(vq);
718 mutex_unlock(&vq->mutex);
719 }
716 720
717 if (oldsock) { 721 if (oldsock) {
718 vhost_net_flush_vq(n, index); 722 vhost_net_flush_vq(n, index);