iommufd: Add iopt_area_alloc()
authorJason Gunthorpe <jgg@nvidia.com>
Mon, 30 Oct 2023 14:26:33 +0000 (11:26 -0300)
committerJason Gunthorpe <jgg@nvidia.com>
Mon, 30 Oct 2023 14:36:04 +0000 (11:36 -0300)
commit361d744ddd61de065fbeb042aaed590d32dd92ec
tree78a027ced85fd087198b0e27552e5b78c34ebf76
parente7250ab7ca4998fe026f2149805b03e09dc32498
iommufd: Add iopt_area_alloc()

We never initialize the two interval tree nodes, and zero fill is not the
same as RB_CLEAR_NODE. This can hide issues where we missed adding the
area to the trees. Factor out the allocation and clear the two nodes.

Fixes: 51fe6141f0f6 ("iommufd: Data structure to provide IOVA to PFN mapping")
Link: https://lore.kernel.org/r/20231030145035.GG691768@ziepe.ca
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/iommu/iommufd/io_pagetable.c
drivers/iommu/iommufd/pages.c