[PATCH] iommufd/device: Fix hwpt at err_unresv in iommufd_device_do_replace()

Nicolin Chen posted 1 patch 1 year, 5 months ago
drivers/iommu/iommufd/device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] iommufd/device: Fix hwpt at err_unresv in iommufd_device_do_replace()
Posted by Nicolin Chen 1 year, 5 months ago
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@vger.kernel.org
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
---
 drivers/iommu/iommufd/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
index 9a7ec5997c61c..3214a4c17c6b3 100644
--- a/drivers/iommu/iommufd/device.c
+++ b/drivers/iommu/iommufd/device.c
@@ -526,7 +526,7 @@ iommufd_device_do_replace(struct iommufd_device *idev,
 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);
-- 
2.43.0
Re: [PATCH] iommufd/device: Fix hwpt at err_unresv in iommufd_device_do_replace()
Posted by Jason Gunthorpe 1 year, 4 months ago
On Wed, Jul 17, 2024 at 10:01:30PM -0700, Nicolin Chen wrote:
> 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@vger.kernel.org
> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
> ---
>  drivers/iommu/iommufd/device.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-rc thanks

Jason
RE: [PATCH] iommufd/device: Fix hwpt at err_unresv in iommufd_device_do_replace()
Posted by Tian, Kevin 1 year, 5 months ago
> From: Nicolin Chen <nicolinc@nvidia.com>
> Sent: Thursday, July 18, 2024 1:02 PM
> 
> 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@vger.kernel.org
> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Re: [PATCH] iommufd/device: Fix hwpt at err_unresv in iommufd_device_do_replace()
Posted by Nicolin Chen 1 year, 4 months ago
On Thu, Jul 18, 2024 at 05:13:38AM +0000, Tian, Kevin wrote:
 
> > From: Nicolin Chen <nicolinc@nvidia.com>
> > Sent: Thursday, July 18, 2024 1:02 PM
> >
> > 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@vger.kernel.org
> > Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
> 
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>

Jason, it seems that we haven't merged this patch, right?

It still applies against v6.11-rc1. So no need of respin.

Thanks
Nicolin
Re: [PATCH] iommufd/device: Fix hwpt at err_unresv in iommufd_device_do_replace()
Posted by Jason Gunthorpe 1 year, 4 months ago
On Sun, Jul 28, 2024 at 04:36:00PM -0700, Nicolin Chen wrote:
> On Thu, Jul 18, 2024 at 05:13:38AM +0000, Tian, Kevin wrote:
>  
> > > From: Nicolin Chen <nicolinc@nvidia.com>
> > > Sent: Thursday, July 18, 2024 1:02 PM
> > >
> > > 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@vger.kernel.org
> > > Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
> > 
> > Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> 
> Jason, it seems that we haven't merged this patch, right?
> 
> It still applies against v6.11-rc1. So no need of respin.

Yes, I will pick it for the rc1 cycle

Jason