6.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicolin Chen <nicolinc@xxxxxxxxxx> commit 950aeefb34923fe3c28ade35fe05f24e2c5b1d55 upstream. The rewind routine should remove the reserved iovas added to the new hwpt. Fixes: 89db31635c87 ("iommufd: Derive iommufd_hwpt_paging from iommufd_hw_pagetable") Cc: stable@xxxxxxxxxxxxxxx Link: https://patch.msgid.link/r/20240718050130.1956804-1-nicolinc@xxxxxxxxxx Signed-off-by: Nicolin Chen <nicolinc@xxxxxxxxxx> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx> Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/iommu/iommufd/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/iommu/iommufd/device.c +++ b/drivers/iommu/iommufd/device.c @@ -525,7 +525,7 @@ iommufd_device_do_replace(struct iommufd err_unresv: if (hwpt_is_paging(hwpt)) iommufd_group_remove_reserved_iova(igroup, - to_hwpt_paging(old_hwpt)); + to_hwpt_paging(hwpt)); err_unlock: mutex_unlock(&idev->igroup->lock); return ERR_PTR(rc);