vfio/iommu_type1: replace kfree with kvfree
authorJiacheng Shi <billsjc@sjtu.edu.cn>
Sun, 12 Dec 2021 09:16:00 +0000 (01:16 -0800)
committerAlex Williamson <alex.williamson@redhat.com>
Tue, 21 Dec 2021 19:30:34 +0000 (12:30 -0700)
Variables allocated by kvzalloc should not be freed by kfree.
Because they may be allocated by vmalloc.
So we replace kfree with kvfree here.

Fixes: d6a4c185660c ("vfio iommu: Implementation of ioctl for dirty pages tracking")
Signed-off-by: Jiacheng Shi <billsjc@sjtu.edu.cn>
Link: https://lore.kernel.org/r/20211212091600.2560-1-billsjc@sjtu.edu.cn
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/vfio_iommu_type1.c

index f17490ab238f46d4fbf63bd66b0ab95cfe855d52..9394aa9444c10c565ce2ffa2aefcfd6b39048f8b 100644 (file)
@@ -256,7 +256,7 @@ static int vfio_dma_bitmap_alloc(struct vfio_dma *dma, size_t pgsize)
 
 static void vfio_dma_bitmap_free(struct vfio_dma *dma)
 {
-       kfree(dma->bitmap);
+       kvfree(dma->bitmap);
        dma->bitmap = NULL;
 }