Skip to content

Commit 6a20f9f

Browse files
jasowangmstsirkin
authored andcommitted
vhost: initialize vq->nheads properly
Commit 7918bb2 ("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: 45347e7 ("vhost: basic in order support") Signed-off-by: Jason Wang <jasowang@redhat.com> Message-Id: <20250729073916.80647-1-jasowang@redhat.com> Reviewed-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com> Tested-by: Breno Leitao <leitao@debian.org> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Tested-by: Jaehoon Kim <jhkim@linux.ibm.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
1 parent 7e161a9 commit 6a20f9f

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/vhost/vhost.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ void vhost_dev_init(struct vhost_dev *dev,
615615
vq->log = NULL;
616616
vq->indirect = NULL;
617617
vq->heads = NULL;
618+
vq->nheads = NULL;
618619
vq->dev = dev;
619620
mutex_init(&vq->mutex);
620621
vhost_vq_reset(dev, vq);

0 commit comments

Comments
 (0)