virtio_blk: verify if queue is broken after virtqueue_get_buf()
authorHeinz Graalfs <graalfs@linux.vnet.ibm.com>
Mon, 28 Oct 2013 23:10:30 +0000 (09:40 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 29 Oct 2013 00:58:17 +0000 (11:28 +1030)
In case virtqueue_get_buf() returned with a NULL pointer verify if the
virtqueue is broken in order to leave while loop.

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/block/virtio_blk.c

index 6b66252fc4e680a03213a2c927e04e4df7faa885..f3be496ac8fa7d7e445aeeb91560d86810f17a5c 100644 (file)
@@ -292,6 +292,8 @@ static void virtblk_done(struct virtqueue *vq)
                                req_done = true;
                        }
                }
+               if (unlikely(virtqueue_is_broken(vq)))
+                       break;
        } while (!virtqueue_enable_cb(vq));
        /* In case queue is stopped waiting for more buffers. */
        if (req_done)