Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vhost/test: fix memory leak of vhost virtqueues

We need free the vqs in .release(), which are allocated in .open().

Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
Link: https://lore.kernel.org/r/20211228030924.3468439-1-xianting.tian@linux.alibaba.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>

authored by

Xianting Tian and committed by
Michael S. Tsirkin
08006392 97143b70

+1
+1
drivers/vhost/test.c
··· 166 166 /* We do an extra flush before freeing memory, 167 167 * since jobs can re-queue themselves. */ 168 168 vhost_test_flush(n); 169 + kfree(n->dev.vqs); 169 170 kfree(n); 170 171 return 0; 171 172 }