linux/drivers/virtio
Cornelia Huck 32fdac0976 virtio: Honour 'may_reduce_num' in vring_create_virtqueue
commit cf94db2190 upstream.

vring_create_virtqueue() allows the caller to specify via the
may_reduce_num parameter whether the vring code is allowed to
allocate a smaller ring than specified.

However, the split ring allocation code tries to allocate a
smaller ring on allocation failure regardless of what the
caller specified. This may cause trouble for e.g. virtio-pci
in legacy mode, which does not support ring resizing. (The
packed ring code does not resize in any case.)

Let's fix this by bailing out immediately in the split ring code
if the requested size cannot be allocated and may_reduce_num has
not been specified.

While at it, fix a typo in the usage instructions.

Fixes: 2a2d1382fe ("virtio: Add improved queue allocation API")
Cc: stable@vger.kernel.org # v4.6+
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-17 08:38:52 +02:00
..
Kconfig virtio: make VIRTIO a menuconfig to ease disabling it all 2018-02-01 16:26:43 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
virtio_balloon.c virtio_balloon: replace oom notifier with shrinker 2018-08-22 00:56:24 +03:00
virtio_input.c virtio: wrap find_vqs 2017-05-02 23:41:42 +03:00
virtio_mmio.c virtio: mmio-v1: Validate queue PFN 2018-08-22 00:56:56 +03:00
virtio_pci_common.c virtio: Make vp_set_vq_affinity() take a mask. 2018-08-11 12:02:18 -07:00
virtio_pci_common.h virtio: Make vp_set_vq_affinity() take a mask. 2018-08-11 12:02:18 -07:00
virtio_pci_legacy.c virtio: pci-legacy: Validate queue pfn 2018-08-22 00:56:58 +03:00
virtio_pci_modern.c virtio_pci: support enabling VFs 2018-06-12 04:59:29 +03:00
virtio_ring.c virtio: Honour 'may_reduce_num' in vring_create_virtqueue 2019-04-17 08:38:52 +02:00
virtio.c virtio: split device_register into device_initialize and device_add 2018-02-01 16:26:45 +02:00