RE: [PATCH] iommufd: viommu: free memory allocated by kvcalloc() using kvfree()
From: Tian, Kevin
Date: Fri Aug 15 2025 - 06:12:17 EST
> From: Akhilesh Patil <akhilesh@xxxxxxxxxxxxx>
> Sent: Sunday, August 10, 2025 9:34 PM
>
> Use kvfree() instead of kfree() to free pages allocated by kvcalloc()
> in iommufs_hw_queue_alloc_phys() to fix potential memory corruption.
> Ensure the memory is properly freed, as kvcalloc may internally use
> vmalloc or kmalloc depending on available memory in the system.
>
> Fixes: 2238ddc2b056 ("iommufd/viommu: Add
> IOMMUFD_CMD_HW_QUEUE_ALLOC ioctl")
> Signed-off-by: Akhilesh Patil <akhilesh@xxxxxxxxxxxxx>
Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>