summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2010-06-10 17:16:11 +0200
committerRusty Russell <rusty@rustcorp.com.au>2010-06-23 15:19:06 +0200
commit686d363786a53ed28ee875b84ef24e6d5126ef6f (patch)
treec97b5c5961df1f051e42a59dcb9ee1884d8f3086 /drivers
parentLinux 2.6.35-rc3 (diff)
downloadlinux-686d363786a53ed28ee875b84ef24e6d5126ef6f.tar.xz
linux-686d363786a53ed28ee875b84ef24e6d5126ef6f.zip
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 <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
Diffstat (limited to 'drivers')
-rw-r--r--drivers/virtio/virtio_ring.c2
1 files changed, 1 insertions, 1 deletions
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++) {