Skip to content

Commit 0800639

Browse files
Xianting Tianmstsirkin
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michael S. Tsirkin <[email protected]> Acked-by: Jason Wang <[email protected]>
1 parent 97143b7 commit 0800639

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/vhost/test.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ static int vhost_test_release(struct inode *inode, struct file *f)
166166
/* We do an extra flush before freeing memory,
167167
* since jobs can re-queue themselves. */
168168
vhost_test_flush(n);
169+
kfree(n->dev.vqs);
169170
kfree(n);
170171
return 0;
171172
}

0 commit comments

Comments
 (0)