]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
virtio_console: free buffers after reset
authorMichael S. Tsirkin <mst@redhat.com>
Fri, 20 Apr 2018 17:24:23 +0000 (20:24 +0300)
committerSasha Levin <alexander.levin@microsoft.com>
Wed, 23 May 2018 01:36:37 +0000 (21:36 -0400)
commita88e13d9a092fbb772d380944b44eb549ef131fe
tree935caa2b7fd44524d80d8b37d65c5b3cac856fa5
parent851c5371237bd1826790c16d9a639af56360cad6
virtio_console: free buffers after reset

[ Upstream commit a7a69ec0d8e4a58be7db88d33cbfa2912807bb2b ]

Console driver is out of spec. The spec says:
A driver MUST NOT decrement the available idx on a live
virtqueue (ie. there is no way to “unexpose” buffers).
and it does exactly that by trying to detach unused buffers
without doing a device reset first.

Defer detaching the buffers until device unplug.

Of course this means we might get an interrupt for
a vq without an attached port now. Handle that by
discarding the consumed buffer.

Reported-by: Tiwei Bie <tiwei.bie@intel.com>
Fixes: b3258ff1d6 ("virtio: Decrement avail idx on buffer detach")
Cc: stable@vger.kernel.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
drivers/char/virtio_console.c