[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH] plat/virtio: Fix virtio-bus init getting hanged



This patch fixes getting hanged in virtio-bus initialization. The inner
while loop does not iterate through all the dev_ids, and failing to find
a match against the first dev_id results in an infinite loop.

Signed-off-by: Cristian Banu <cristb@xxxxxxxxx>
---
 plat/drivers/virtio/virtio_bus.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/plat/drivers/virtio/virtio_bus.c b/plat/drivers/virtio/virtio_bus.c
index 48a24678ea78..3fc86ea827f6 100644
--- a/plat/drivers/virtio/virtio_bus.c
+++ b/plat/drivers/virtio/virtio_bus.c
@@ -79,11 +79,13 @@ static struct virtio_driver *find_match_drv(struct 
virtio_dev *vdev)
        struct virtio_driver *drv = NULL;
 
        UK_TAILQ_FOREACH(drv, &virtio_drvs, next) {
+               i = 0;
                while (drv->dev_ids[i].virtio_device_id != VIRTIO_ID_INVALID) {
                        if (virtio_device_id_match(&drv->dev_ids[i],
                                                   &vdev->id)) {
                                return drv;
                        }
+                       i++;
                }
        }
        return NULL;
-- 
2.11.0


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.