All of lore.kernel.org
 help / color / mirror / Atom feed
From: JAEHOON KIM <jhkim@linux.ibm.com>
To: Jason Wang <jasowang@redhat.com>, mst@redhat.com, eperezma@redhat.com
Cc: kvm@vger.kernel.org, virtualization@lists.linux.dev,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	sgarzare@redhat.com, will@kernel.org,
	Breno Leitao <leitao@debian.org>
Subject: Re: [PATCH] vhost: initialize vq->nheads properly
Date: Tue, 29 Jul 2025 08:51:31 -0500	[thread overview]
Message-ID: <f2d3027f-44d1-44d2-b89c-e01085c6d036@linux.ibm.com> (raw)
In-Reply-To: <20250729073916.80647-1-jasowang@redhat.com>

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@linux.ibm.com>
> Reported-by: Breno Leitao <leitao@debian.org>
> Fixes: 7918bb2d19c9 ("vhost: basic in order support")
> Signed-off-by: Jason Wang <jasowang@redhat.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@linux.ibm.com>


  parent reply	other threads:[~2025-07-29 13:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-29  7:39 [PATCH] vhost: initialize vq->nheads properly Jason Wang
2025-07-29  8:09 ` Dawid Osuchowski
2025-07-29  9:11 ` Breno Leitao
2025-07-29  9:56 ` Stefano Garzarella
2025-07-29 13:51 ` JAEHOON KIM [this message]
2025-08-04  9:05 ` Jason Wang
2025-08-04 15:57   ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f2d3027f-44d1-44d2-b89c-e01085c6d036@linux.ibm.com \
    --to=jhkim@linux.ibm.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sgarzare@redhat.com \
    --cc=virtualization@lists.linux.dev \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.