Tested-by: JiangYuX <yux.ji...@intel.com>

    Best Regards
    Jiang yu

> -----Original Message-----
> From: Maxime Coquelin [mailto:maxime.coque...@redhat.com]
> Sent: Friday, November 6, 2020 10:48 PM
> To: dev@dpdk.org; Xia, Chenbo <chenbo....@intel.com>;
> amore...@redhat.com
> Cc: sta...@dpdk.org; Maxime Coquelin <maxime.coque...@redhat.com>;
> Jiang, YuX <yux.ji...@intel.com>
> Subject: [PATCH] vhost: fix virtqueue initialization
> 
> This patches fixes virtqueue initialization issue causing segfault or file
> descriptor being closed unexpectedly.
> 
> The wrong index was passed to init_vring_queue() by
> alloc_vring_queue() when a hole in the virtqueue array was met.
> 
> Fixes: 8acd7c213353 ("vhost: fix virtqueues metadata allocation")
> Cc: sta...@dpdk.org
> 
> Reported-by: Yu Jiang <yux.ji...@intel.com>
> Signed-off-by: Maxime Coquelin <maxime.coque...@redhat.com>
> ---
>  lib/librte_vhost/vhost.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index
> 8a151a9c1d..b83cf639eb 100644
> --- a/lib/librte_vhost/vhost.c
> +++ b/lib/librte_vhost/vhost.c
> @@ -605,7 +605,7 @@ alloc_vring_queue(struct virtio_net *dev, uint32_t
> vring_idx)
>               }
> 
>               dev->virtqueue[i] = vq;
> -             init_vring_queue(dev, vring_idx);
> +             init_vring_queue(dev, i);
>               rte_spinlock_init(&vq->access_lock);
>               vq->avail_wrap_counter = 1;
>               vq->used_wrap_counter = 1;
> --
> 2.26.2

Reply via email to