Re: [PATCH] vhost: initialize vq->nheads properly

From: Dawid Osuchowski
Date: Tue Jul 29 2025 - 04:09:46 EST


On 2025-07-29 9: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.

nit: as someone who is not familiar with vhost code, it took me a while to figure out you meant VHOST_SET_OWNER and the corresponding vhost_dev_set_owner()


Reported-by: JAEHOON KIM <jhkim@xxxxxxxxxxxxx>
Reported-by: Breno Leitao <leitao@xxxxxxxxxx>
Fixes: 7918bb2d19c9 ("vhost: basic in order support")
Signed-off-by: Jason Wang <jasowang@xxxxxxxxxx>

Reviewed-by: Dawid Osuchowski <dawid.osuchowski@xxxxxxxxxxxxxxx>

Thanks,
Dawid