Skip to content

Commit

Permalink
virtio: return ENOMEM on out of memory
Browse files Browse the repository at this point in the history
add_buf returns ring size on out of memory,
this is not what devices expect.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: stable@kernel.org # .34.x
  • Loading branch information
Michael S. Tsirkin authored and Rusty Russell committed Jun 23, 2010
1 parent 7e27d6e commit 686d363
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/virtio/virtio_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit 686d363

Please sign in to comment.