[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f2d3027f-44d1-44d2-b89c-e01085c6d036@linux.ibm.com>
Date: Tue, 29 Jul 2025 08:51:31 -0500
From: JAEHOON KIM <jhkim@...ux.ibm.com>
To: Jason Wang <jasowang@...hat.com>, mst@...hat.com, eperezma@...hat.com
Cc: kvm@...r.kernel.org, virtualization@...ts.linux.dev,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
sgarzare@...hat.com, will@...nel.org, Breno Leitao <leitao@...ian.org>
Subject: Re: [PATCH] vhost: initialize vq->nheads properly
On 7/29/2025 2:39 AM, Jason Wang wrote:
> Commit 7918bb2d19c9 ("vhost: basic in order support") introduces
> vq->nheads to store the number of batched used buffers per used elem
> but it forgets to initialize the vq->nheads to NULL in
> vhost_dev_init() this will cause kfree() that would try to free it
> without be allocated if SET_OWNER is not called.
>
> Reported-by: JAEHOON KIM <jhkim@...ux.ibm.com>
> Reported-by: Breno Leitao <leitao@...ian.org>
> Fixes: 7918bb2d19c9 ("vhost: basic in order support")
> Signed-off-by: Jason Wang <jasowang@...hat.com>
> ---
> drivers/vhost/vhost.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index a4873d116df1..b4dfe38c7008 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -615,6 +615,7 @@ void vhost_dev_init(struct vhost_dev *dev,
> vq->log = NULL;
> vq->indirect = NULL;
> vq->heads = NULL;
> + vq->nheads = NULL;
> vq->dev = dev;
> mutex_init(&vq->mutex);
> vhost_vq_reset(dev, vq);
>
checked and confirmed no crash occurs.
Thanks for the fast update.
Tested-by: Jaehoon Kim <jhkim@...ux.ibm.com>
Powered by blists - more mailing lists