All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: linux-kernel@vger.kernel.org
Cc: virtualization@lists.linux-foundation.org
Subject: [PATCH 1/6] virtio: ignore corrupted virtqueues rather than spinning.
Date: Wed, 23 Apr 2008 23:55:47 -0500	[thread overview]
Message-ID: <200804241455.47462.rusty@rustcorp.com.au> (raw)


A corrupt virtqueue (caused by the other end screwing up) can have
strange results such as a driver spinning: just bail when we try to
get a buffer from a known-broken queue.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 drivers/virtio/virtio_ring.c |    5 +++++
 1 file changed, 5 insertions(+)

diff -r cbd83e592664 drivers/virtio/virtio_ring.c
--- a/drivers/virtio/virtio_ring.c	Fri Apr 04 22:42:47 2008 +1100
+++ b/drivers/virtio/virtio_ring.c	Sat Apr 05 21:12:42 2008 +1100
@@ -184,6 +184,11 @@ static void *vring_get_buf(struct virtqu
 
 	START_USE(vq);
 
+	if (unlikely(vq->broken)) {
+		END_USE(vq);
+		return NULL;
+	}
+
 	if (!more_used(vq)) {
 		pr_debug("No more buffers in queue\n");
 		END_USE(vq);


             reply	other threads:[~2008-04-24  4:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-24  4:55 Rusty Russell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-04-24  4:55 [PATCH 1/6] virtio: ignore corrupted virtqueues rather than spinning Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200804241455.47462.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.