public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] virtio: ignore corrupted virtqueues rather than spinning.
@ 2008-04-24  4:55 Rusty Russell
  0 siblings, 0 replies; only message in thread
From: Rusty Russell @ 2008-04-24  4:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: virtualization


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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-04-24  4:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-24  4:55 [PATCH 1/6] virtio: ignore corrupted virtqueues rather than spinning Rusty Russell

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