aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2011-03-16 19:12:10 +0530
committerGreg Kroah-Hartman <gregkh@suse.de>2011-05-02 09:19:34 -0700
commit045707f94023998aa702536bb2fb441d8a049475 (patch)
tree5033955a65c6ed6a4e22b59393f2f0505a2d7a3f /drivers
parenteceb743cdc65d1b78d91f786cc2a2acb9ab2d116 (diff)
virtio: Decrement avail idx on buffer detach
commit b3258ff1d6086bd2b9eeb556844a868ad7d49bc8 upstream. When detaching a buffer from a vq, the avail.idx value should be decremented as well. This was noticed by hot-unplugging a virtio console port and then plugging in a new one on the same number (re-using the vqs which were just 'disowned'). qemu reported 'Guest moved used index from 0 to 256' when any IO was attempted on the new port. Reported-by: juzhang <juzhang@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/virtio/virtio_ring.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index cc2f73e0347..b0043fb26a4 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -371,6 +371,7 @@ void *virtqueue_detach_unused_buf(struct virtqueue *_vq)
/* detach_buf clears data, so grab it now. */
buf = vq->data[i];
detach_buf(vq, i);
+ vq->vring.avail->idx--;
END_USE(vq);
return buf;
}