[002/205] virtio: return ENOMEM on out of memory

From: Greg KH
Date: Fri Jul 30 2010 - 13:54:16 EST


2.6.34-stable review patch. If anyone has any objections, please let us know.

------------------

From: Michael S. Tsirkin <mst@xxxxxxxxxx>

commit 686d363786a53ed28ee875b84ef24e6d5126ef6f upstream.

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

Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
Acked-by: Amit Shah <amit.shah@xxxxxxxxxx>
Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
drivers/virtio/virtio_ring.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -118,7 +118,7 @@ static int vring_add_indirect(struct vri

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

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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/