Skip to content

Commit 7bbd072

Browse files
committed
iommufd: Fix missing update of domains_itree after splitting iopt_area
jira LE-1907 cve CVE-2023-52801 Rebuild_History Non-Buildable kernel-5.14.0-427.35.1.el9_4 commit-author Koichiro Den <den@valinux.co.jp> commit e7250ab 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: 51fe614 ("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> (cherry picked from commit e7250ab) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 9253325 commit 7bbd072

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/iommu/iommufd/io_pagetable.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,16 @@ static int iopt_area_split(struct iopt_area *area, unsigned long iova)
10481048
if (WARN_ON(rc))
10491049
goto err_remove_lhs;
10501050

1051+
/*
1052+
* If the original area has filled a domain, domains_itree has to be
1053+
* updated.
1054+
*/
1055+
if (area->storage_domain) {
1056+
interval_tree_remove(&area->pages_node, &pages->domains_itree);
1057+
interval_tree_insert(&lhs->pages_node, &pages->domains_itree);
1058+
interval_tree_insert(&rhs->pages_node, &pages->domains_itree);
1059+
}
1060+
10511061
lhs->storage_domain = area->storage_domain;
10521062
lhs->pages = area->pages;
10531063
rhs->storage_domain = area->storage_domain;

0 commit comments

Comments
 (0)