summaryrefslogtreecommitdiffstats
path: root/drivers/virtio/virtio_ring.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-05-03 04:50:43 +0200
committerRusty Russell <rusty@rustcorp.com.au>2008-05-02 13:50:43 +0200
commit5ef827526fc01820a7a80827802e9fad3f34f937 (patch)
treec41345c6de6ad5b4b4d7071aa46a9e27a773247c /drivers/virtio/virtio_ring.c
parentMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/iee... (diff)
downloadlinux-5ef827526fc01820a7a80827802e9fad3f34f937.tar.xz
linux-5ef827526fc01820a7a80827802e9fad3f34f937.zip
virtio: ignore corrupted virtqueues rather than spinning.
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>
Diffstat (limited to 'drivers/virtio/virtio_ring.c')
-rw-r--r--drivers/virtio/virtio_ring.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index c2fa5c630813..937a49d6772c 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -184,6 +184,11 @@ static void *vring_get_buf(struct virtqueue *_vq, unsigned int *len)
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);