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

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Tue Jul 16 05:39:52 MSK 2024


Nice catch!

On 7/15/24 21:49, Alexander Ivanov wrote:
> 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

Reviewed-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>

> 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)

-- 
Best regards, Tikhomirov Pavel
Senior Software Developer, Virtuozzo.


More information about the Devel mailing list