Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 686d3637 authored by Michael S. Tsirkin's avatar Michael S. Tsirkin Committed by Rusty Russell
Browse files

virtio: return ENOMEM on out of memory



add_buf returns ring size on out of memory,
this is not what devices expect.

Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarAmit Shah <amit.shah@redhat.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Cc: stable@kernel.org # .34.x
parent 7e27d6e7
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -119,7 +119,7 @@ static int vring_add_indirect(struct vring_virtqueue *vq,


	desc = kmalloc((out + in) * sizeof(struct vring_desc), gfp);
	desc = kmalloc((out + in) * sizeof(struct vring_desc), gfp);
	if (!desc)
	if (!desc)
		return vq->vring.num;
		return -ENOMEM;


	/* Transfer entries from the sg list into the indirect page */
	/* Transfer entries from the sg list into the indirect page */
	for (i = 0; i < out; i++) {
	for (i = 0; i < out; i++) {