public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6.6.y] iommu/amd: Fixes refcount bug in iommu_v2 driver
@ 2025-03-06  5:18 Siddharth Chintamaneni
  2025-03-06  7:01 ` Greg KH
  2025-03-06 19:11 ` Sasha Levin
  0 siblings, 2 replies; 3+ messages in thread
From: Siddharth Chintamaneni @ 2025-03-06  5:18 UTC (permalink / raw)
  To: stable
  Cc: joro, suravee.suthikulpanit, will, robin.murphy, iommu,
	linux-kernel, wei.huang2, apais, Siddharth Chintamaneni

This fix addresses a refcount bug where the reference count was not
properly decremented due to the mmput function not being called when
mmu_notifier_register fails.

Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com>
---
 drivers/iommu/amd/iommu_v2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/amd/iommu_v2.c b/drivers/iommu/amd/iommu_v2.c
index 57c2fb1146e2..bce21e266d64 100644
--- a/drivers/iommu/amd/iommu_v2.c
+++ b/drivers/iommu/amd/iommu_v2.c
@@ -645,7 +645,7 @@ int amd_iommu_bind_pasid(struct pci_dev *pdev, u32 pasid,
 
 	ret = mmu_notifier_register(&pasid_state->mn, mm);
 	if (ret)
-		goto out_free;
+		goto out_mmput;
 
 	ret = set_pasid_state(dev_state, pasid_state, pasid);
 	if (ret)
@@ -673,6 +673,8 @@ int amd_iommu_bind_pasid(struct pci_dev *pdev, u32 pasid,
 
 out_unregister:
 	mmu_notifier_unregister(&pasid_state->mn, mm);
+
+out_mmput:
 	mmput(mm);
 
 out_free:
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 6.6.y] iommu/amd: Fixes refcount bug in iommu_v2 driver
  2025-03-06  5:18 [PATCH 6.6.y] iommu/amd: Fixes refcount bug in iommu_v2 driver Siddharth Chintamaneni
@ 2025-03-06  7:01 ` Greg KH
  2025-03-06 19:11 ` Sasha Levin
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2025-03-06  7:01 UTC (permalink / raw)
  To: Siddharth Chintamaneni
  Cc: stable, joro, suravee.suthikulpanit, will, robin.murphy, iommu,
	linux-kernel, wei.huang2, apais

On Thu, Mar 06, 2025 at 05:18:22AM +0000, Siddharth Chintamaneni wrote:
> This fix addresses a refcount bug where the reference count was not
> properly decremented due to the mmput function not being called when
> mmu_notifier_register fails.
> 
> Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com>
> ---
>  drivers/iommu/amd/iommu_v2.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/amd/iommu_v2.c b/drivers/iommu/amd/iommu_v2.c
> index 57c2fb1146e2..bce21e266d64 100644
> --- a/drivers/iommu/amd/iommu_v2.c
> +++ b/drivers/iommu/amd/iommu_v2.c
> @@ -645,7 +645,7 @@ int amd_iommu_bind_pasid(struct pci_dev *pdev, u32 pasid,
>  
>  	ret = mmu_notifier_register(&pasid_state->mn, mm);
>  	if (ret)
> -		goto out_free;
> +		goto out_mmput;
>  
>  	ret = set_pasid_state(dev_state, pasid_state, pasid);
>  	if (ret)
> @@ -673,6 +673,8 @@ int amd_iommu_bind_pasid(struct pci_dev *pdev, u32 pasid,
>  
>  out_unregister:
>  	mmu_notifier_unregister(&pasid_state->mn, mm);
> +
> +out_mmput:
>  	mmput(mm);
>  
>  out_free:
> -- 
> 2.43.0
> 
> 

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 6.6.y] iommu/amd: Fixes refcount bug in iommu_v2 driver
  2025-03-06  5:18 [PATCH 6.6.y] iommu/amd: Fixes refcount bug in iommu_v2 driver Siddharth Chintamaneni
  2025-03-06  7:01 ` Greg KH
@ 2025-03-06 19:11 ` Sasha Levin
  1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2025-03-06 19:11 UTC (permalink / raw)
  To: stable, sidchintamaneni; +Cc: Sasha Levin

[ Sasha's backport helper bot ]

Hi,

Summary of potential issues:
⚠️ Could not find matching upstream commit

No upstream commit was identified. Using temporary commit for testing.

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.6.y        |  Success    |  Success   |

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-06 19:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-06  5:18 [PATCH 6.6.y] iommu/amd: Fixes refcount bug in iommu_v2 driver Siddharth Chintamaneni
2025-03-06  7:01 ` Greg KH
2025-03-06 19:11 ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox