[Devel] [PATCH VZ9] drivers/vhost: drivers/vhost: Fix uninitialized variable in vhost_work_queue()

Alexander Ivanov alexander.ivanov at virtuozzo.com
Mon Jul 15 16:49:50 MSK 2024


Set the index variable to zero before passing its pointer to xa_find().

Fixes: 17ad03ac78b9 ("drivers/vhost: fix missing rcu_read_lock in vhost_work_queue")
https://virtuozzo.atlassian.net/browse/PSBM-157296
Signed-off-by: Alexander Ivanov <alexander.ivanov at virtuozzo.com>
---
 drivers/vhost/vhost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index c551e8d215b6..1eac6e2f62a5 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -258,7 +258,7 @@ static bool vhost_worker_queue(struct vhost_worker *worker,
 bool vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work)
 {
 	struct vhost_worker *worker;
-	unsigned long i;
+	unsigned long i = 0;
 
 	worker = xa_find(&dev->worker_xa, &i, ULONG_MAX, XA_PRESENT);
 	if (!worker)
-- 
2.43.0



More information about the Devel mailing list