]> git.baikalelectronics.ru Git - kernel.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)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 25 Apr 2018 17:41:16 +0000 (20:41 +0300)
commit874d1e4d6232885e40d91bb653280f385c90ed5b
tree01374a64530550c86ddf3bc55b55c9366dbdb62d
parent951b73a9d5f60ad72d6c21cb61b3036bac31e890
virtio_console: free buffers after reset

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: 40021dfd05 ("virtio: Decrement avail idx on buffer detach")
Cc: stable@vger.kernel.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/char/virtio_console.c