iommufd: Fix missing update of domains_itree after splitting iopt_area
authorKoichiro Den <den@valinux.co.jp>
Fri, 27 Oct 2023 16:29:42 +0000 (01:29 +0900)
committerJason Gunthorpe <jgg@nvidia.com>
Mon, 30 Oct 2023 14:36:04 +0000 (11:36 -0300)
commite7250ab7ca4998fe026f2149805b03e09dc32498
treedf3a20124624a34a43527321699f87f1d9ea31c2
parent03476e687eb07b94f7cdb07cd3c7c4304b6c58b3
iommufd: Fix missing update of domains_itree after splitting iopt_area

In iopt_area_split(), if the original iopt_area has filled a domain and is
linked to domains_itree, pages_nodes have to be properly
reinserted. Otherwise the domains_itree becomes corrupted and we will UAF.

Fixes: 51fe6141f0f6 ("iommufd: Data structure to provide IOVA to PFN mapping")
Link: https://lore.kernel.org/r/20231027162941.2864615-2-den@valinux.co.jp
Cc: stable@vger.kernel.org
Signed-off-by: Koichiro Den <den@valinux.co.jp>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/iommu/iommufd/io_pagetable.c