From: Rusty Russell Date: Sat, 3 May 2008 02:50:43 +0000 (-0500) Subject: virtio: ignore corrupted virtqueues rather than spinning. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5ef827526fc01820a7a80827802e9fad3f34f937;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 --- 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);