public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-2.6.35] virtio: return ENOMEM on out of memory
@ 2010-06-10 15:16 Michael S. Tsirkin
  2010-06-11 12:24 ` Amit Shah
  2010-06-15  4:34 ` Rusty Russell
  0 siblings, 2 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2010-06-10 15:16 UTC (permalink / raw)
  To: Rusty Russell, Michael S. Tsirkin, Amit Shah, Mark McLoughlin,
	Tejun Heo, linux-kernel

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

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

Please consider this patch for 2.6.35.

 drivers/virtio/virtio_ring.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index ed845b7..dd35b34 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++) {
-- 
1.7.1.12.g42b7f

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-06-15  4:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-10 15:16 [PATCH for-2.6.35] virtio: return ENOMEM on out of memory Michael S. Tsirkin
2010-06-11 12:24 ` Amit Shah
2010-06-15  4:34 ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox