From: Michael S. Tsirkin Date: Thu, 10 Jun 2010 15:16:11 +0000 (+0300) Subject: virtio: return ENOMEM on out of memory X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=686d363786a53ed28ee875b84ef24e6d5126ef6f;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 --- 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++) {