From 686d363786a53ed28ee875b84ef24e6d5126ef6f Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Thu, 10 Jun 2010 18:16:11 +0300 Subject: [PATCH] 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: Michael S. Tsirkin Acked-by: Amit Shah Signed-off-by: Rusty Russell Cc: stable@kernel.org # .34.x --- drivers/virtio/virtio_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 1ca88908723b..afe7e21dd0ae 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -119,7 +119,7 @@ static int vring_add_indirect(struct vring_virtqueue *vq, desc = kmalloc((out + in) * sizeof(struct vring_desc), gfp); if (!desc) - return vq->vring.num; + return -ENOMEM; /* Transfer entries from the sg list into the indirect page */ for (i = 0; i < out; i++) { -- 2.20.1