android_kernel_lge_bullhead/drivers/virtio
Ladi Prosek e2e1170de6 virtio_balloon: init 1st buffer in stats vq
commit fc8653228c8588a120f6b5dad6983b7b61ff669e upstream.

When init_vqs runs, virtio_balloon.stats is either uninitialized or
contains stale values. The host updates its state with garbage data
because it has no way of knowing that this is just a marker buffer
used for signaling.

This patch updates the stats before pushing the initial buffer.

Alternative fixes:
* Push an empty buffer in init_vqs. Not easily done with the current
  virtio implementation and violates the spec "Driver MUST supply the
  same subset of statistics in all buffers submitted to the statsq".
* Push a buffer with invalid tags in init_vqs. Violates the same
  spec clause, plus "invalid tag" is not really defined.

Note: the spec says:
	When using the legacy interface, the device SHOULD ignore all values in
	the first buffer in the statsq supplied by the driver after device
	initialization. Note: Historically, drivers supplied an uninitialized
	buffer in the first buffer.

Unfortunately QEMU does not seem to implement the recommendation
even for the legacy interface.

Signed-off-by: Ladi Prosek <lprosek@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
2017-06-20 14:04:37 +02:00
..
Kconfig drivers/virtio: remove depends on CONFIG_EXPERIMENTAL 2013-01-11 11:39:04 -08:00
Makefile virtio: remove CONFIG_VIRTIO_RING 2012-09-28 15:05:15 +09:30
config.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
virtio.c virtio: fix memory leak of virtio ida cache layers 2016-03-03 15:06:21 -08:00
virtio_balloon.c virtio_balloon: init 1st buffer in stats vq 2017-06-20 14:04:37 +02:00
virtio_mmio.c virtio: make config_ops const 2013-02-11 15:32:17 +10:30
virtio_pci.c virtio_pci: fix virtio spec compliance on restore 2014-11-14 08:47:55 -08:00
virtio_ring.c virtio: support unlocked queue poll 2013-07-28 16:29:55 -07:00