diff options
author | Cornelia Huck <cohuck@redhat.com> | 2019-04-08 14:33:22 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2019-04-08 17:05:52 -0400 |
commit | cf94db21905333e610e479688add629397a4b384 (patch) | |
tree | c03b1e320df04d9d5025e0e2ddcf80d002950d24 /include/linux/virtio_ring.h | |
parent | 5e9642a2e14cd0f5be14186681f280979bb3f3cd (diff) | |
download | talos-op-linux-cf94db21905333e610e479688add629397a4b384.tar.gz talos-op-linux-cf94db21905333e610e479688add629397a4b384.zip |
virtio: Honour 'may_reduce_num' in vring_create_virtqueue
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: 2a2d1382fe9d ("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>
Diffstat (limited to 'include/linux/virtio_ring.h')
-rw-r--r-- | include/linux/virtio_ring.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h index fab02133a919..3dc70adfe5f5 100644 --- a/include/linux/virtio_ring.h +++ b/include/linux/virtio_ring.h @@ -63,7 +63,7 @@ struct virtqueue; /* * Creates a virtqueue and allocates the descriptor ring. If * may_reduce_num is set, then this may allocate a smaller ring than - * expected. The caller should query virtqueue_get_ring_size to learn + * expected. The caller should query virtqueue_get_vring_size to learn * the actual size of the ring. */ struct virtqueue *vring_create_virtqueue(unsigned int index, |