aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/virtio
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2011-03-16 09:42:10 -0400
committerRusty Russell <rusty@rustcorp.com.au>2011-04-21 09:27:00 -0400
commitb3258ff1d6086bd2b9eeb556844a868ad7d49bc8 (patch)
tree2c9dde005804227038c997a983ded7e46951ca64 /drivers/virtio
parent584f79046780e10cb24367a691f8c28398a00e84 (diff)
virtio: Decrement avail idx on buffer detach
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. CC: stable@kernel.org Reported-by: juzhang <juzhang@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/virtio')
-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 cc2f73e03475..b0043fb26a4d 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)
371 /* detach_buf clears data, so grab it now. */ 371 /* detach_buf clears data, so grab it now. */
372 buf = vq->data[i]; 372 buf = vq->data[i];
373 detach_buf(vq, i); 373 detach_buf(vq, i);
374 vq->vring.avail->idx--;
374 END_USE(vq); 375 END_USE(vq);
375 return buf; 376 return buf;
376 } 377 }