virtio: Decrement avail idx on buffer detach
authorAmit Shah <amit.shah@redhat.com>
Wed, 16 Mar 2011 13:42:10 +0000 (19:12 +0530)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 21 Apr 2011 13:27:00 +0000 (22:57 +0930)
commitb3258ff1d6086bd2b9eeb556844a868ad7d49bc8
tree2c9dde005804227038c997a983ded7e46951ca64
parent584f79046780e10cb24367a691f8c28398a00e84
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>
drivers/virtio/virtio_ring.c