Commit c047e5f3170c2595e66ed67f87cec01afd717212
1 parent
b834226b04
Exists in
master
and in
20 other branches
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>
Showing 1 changed file with 5 additions and 1 deletions Side-by-side Diff
drivers/vhost/net.c
... | ... | @@ -711,8 +711,12 @@ |
711 | 711 | |
712 | 712 | mutex_unlock(&vq->mutex); |
713 | 713 | |
714 | - if (oldubufs) | |
714 | + if (oldubufs) { | |
715 | 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 | 721 | if (oldsock) { |
718 | 722 | vhost_net_flush_vq(n, index); |