Re: [PATCH] iommufd: viommu: free memory allocated by kvcalloc() using kvfree()

From: Robin Murphy
Date: Fri Aug 15 2025 - 10:16:16 EST


On 15/08/2025 2:42 pm, Markus Elfring wrote:
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.

Will another bit of background information become helpful
for an improved change description?

No it will not. Please stop pointlessly nitpicking. A thing that is allocated with kv*alloc() must be freed with kvfree(); that alone is all that needs to be said to explain and justify any patch fixing this particular bug.

Thanks,
Robin.