]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iommufd/selftest: Fix page leaks in mock_viommu_{init,destroy}
authorThorsten Blum <thorsten.blum@linux.dev>
Thu, 12 Mar 2026 16:40:42 +0000 (17:40 +0100)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 13 Mar 2026 16:28:40 +0000 (13:28 -0300)
commit09c091fddb0b93297ea659ab48ee64f54ebeeaa2
treee3a11867ecf9e01e77d7742d01b6d6248407ca87
parent7147ec874ea08c322d779d8eba28946e294ed1f3
iommufd/selftest: Fix page leaks in mock_viommu_{init,destroy}

mock_viommu_init() allocates two pages using __get_free_pages(..., 1),
but its error path and mock_viommu_destroy() only release the first page
using free_page(), leaking the second page. Use free_pages() with the
matching order instead to avoid any page leaks.

Fixes: 80478a2b450e ("iommufd/selftest: Add coverage for the new mmap interface")
Link: https://patch.msgid.link/r/20260312164040.457293-3-thorsten.blum@linux.dev
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Pranjal Shrivastava <praan@google.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/iommu/iommufd/selftest.c