linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Intel IOMMU: fix sysfs leak in hotplug init path
@ 2021-04-21 15:12 Rolf Eike Beer
  2021-04-22  2:46 ` Lu Baolu
  2021-04-22  5:39 ` [PATCH] iommu/vt-d: Fix sysfs leak in alloc_domain() Rolf Eike Beer
  0 siblings, 2 replies; 6+ messages in thread
From: Rolf Eike Beer @ 2021-04-21 15:12 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon; +Cc: David Woodhouse, Lu Baolu, iommu, linux-kernel

Signed-off-by: Rolf Eike Beer <eb@emlix.com>
---
 drivers/iommu/intel/dmar.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

I have not actually tested this but I guess it should match the code in 
free_iommu() just below.

diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c
index d5c51b5c20af..fb37a9b79b3a 100644
--- a/drivers/iommu/intel/dmar.c
+++ b/drivers/iommu/intel/dmar.c
@@ -1144,7 +1144,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
 
 		err = iommu_device_register(&iommu->iommu);
 		if (err)
-			goto err_unmap;
+			goto err_unregister;
 	}
 
 	drhd->iommu = iommu;
@@ -1152,6 +1152,8 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
 
 	return 0;
 
+err_unregister:
+	iommu_device_sysfs_remove(&iommu->iommu);
 err_unmap:
 	unmap_iommu(iommu);
 error_free_seq_id:
-- 
2.31.1


-- 
Rolf Eike Beer, emlix GmbH, http://www.emlix.com
Fon +49 551 30664-0, Fax +49 551 30664-11
Gothaer Platz 3, 37083 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055

emlix - smart embedded open source




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

* Re: [PATCH] Intel IOMMU: fix sysfs leak in hotplug init path
  2021-04-21 15:12 [PATCH] Intel IOMMU: fix sysfs leak in hotplug init path Rolf Eike Beer
@ 2021-04-22  2:46 ` Lu Baolu
  2021-04-22  5:39 ` [PATCH] iommu/vt-d: Fix sysfs leak in alloc_domain() Rolf Eike Beer
  1 sibling, 0 replies; 6+ messages in thread
From: Lu Baolu @ 2021-04-22  2:46 UTC (permalink / raw)
  To: Rolf Eike Beer, Joerg Roedel, Will Deacon
  Cc: baolu.lu, David Woodhouse, iommu, linux-kernel

Hi Rolf,

On 4/21/21 11:12 PM, Rolf Eike Beer wrote:
> Signed-off-by: Rolf Eike Beer <eb@emlix.com>

Thanks for the patch!

Can you please adjust the subject to "iommu/vt-d: Fix sysfs leak in
alloc_domain()"? It's not only for hotplug path.

Please also add commit message.

Add below Fixes tag as well:

Fixes: 39ab9555c2411 ("iommu: Add sysfs bindings for struct iommu_device")

> ---
>   drivers/iommu/intel/dmar.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> I have not actually tested this but I guess it should match the code in
> free_iommu() just below.
> 
> diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c
> index d5c51b5c20af..fb37a9b79b3a 100644
> --- a/drivers/iommu/intel/dmar.c
> +++ b/drivers/iommu/intel/dmar.c
> @@ -1144,7 +1144,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
>   
>   		err = iommu_device_register(&iommu->iommu);
>   		if (err)
> -			goto err_unmap;
> +			goto err_unregister;
>   	}
>   
>   	drhd->iommu = iommu;
> @@ -1152,6 +1152,8 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
>   
>   	return 0;
>   
> +err_unregister:
> +	iommu_device_sysfs_remove(&iommu->iommu);
>   err_unmap:
>   	unmap_iommu(iommu);
>   error_free_seq_id:
> 

Best regards,
baolu

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

* Re: [PATCH] iommu/vt-d: Fix sysfs leak in alloc_domain()
  2021-04-22  5:39 ` [PATCH] iommu/vt-d: Fix sysfs leak in alloc_domain() Rolf Eike Beer
@ 2021-04-22  5:34   ` Lu Baolu
  2021-05-21  6:53     ` Rolf Eike Beer
  0 siblings, 1 reply; 6+ messages in thread
From: Lu Baolu @ 2021-04-22  5:34 UTC (permalink / raw)
  To: Rolf Eike Beer, Joerg Roedel, Will Deacon
  Cc: baolu.lu, David Woodhouse, iommu, linux-kernel

Hi Rolf,

On 4/22/21 1:39 PM, Rolf Eike Beer wrote:
> iommu_device_sysfs_add() is called before, so is has to be cleaned on subsequent
> errors.
> 
> Fixes: 39ab9555c2411 ("iommu: Add sysfs bindings for struct iommu_device")
> Cc: stable@vger.kernel.org # 4.11.x
> Signed-off-by: Rolf Eike Beer <eb@emlix.com>

Acked-by: Lu Baolu <baolu.lu@linux.intel.com>

P.S. Next time when you submit a new version, please use a version tag.

Best regards,
baolu

> ---
>   drivers/iommu/intel/dmar.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c
> index d5c51b5c20af..c2bfccb19e24 100644
> --- a/drivers/iommu/intel/dmar.c
> +++ b/drivers/iommu/intel/dmar.c
> @@ -1144,7 +1144,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
>   
>   		err = iommu_device_register(&iommu->iommu);
>   		if (err)
> -			goto err_unmap;
> +			goto err_sysfs;
>   	}
>   
>   	drhd->iommu = iommu;
> @@ -1152,6 +1152,8 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
>   
>   	return 0;
>   
> +err_sysfs:
> +	iommu_device_sysfs_remove(&iommu->iommu);
>   err_unmap:
>   	unmap_iommu(iommu);
>   error_free_seq_id:
> 

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

* [PATCH] iommu/vt-d: Fix sysfs leak in alloc_domain()
  2021-04-21 15:12 [PATCH] Intel IOMMU: fix sysfs leak in hotplug init path Rolf Eike Beer
  2021-04-22  2:46 ` Lu Baolu
@ 2021-04-22  5:39 ` Rolf Eike Beer
  2021-04-22  5:34   ` Lu Baolu
  1 sibling, 1 reply; 6+ messages in thread
From: Rolf Eike Beer @ 2021-04-22  5:39 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon; +Cc: David Woodhouse, Lu Baolu, iommu, linux-kernel

iommu_device_sysfs_add() is called before, so is has to be cleaned on subsequent
errors.

Fixes: 39ab9555c2411 ("iommu: Add sysfs bindings for struct iommu_device")
Cc: stable@vger.kernel.org # 4.11.x
Signed-off-by: Rolf Eike Beer <eb@emlix.com>
---
 drivers/iommu/intel/dmar.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c
index d5c51b5c20af..c2bfccb19e24 100644
--- a/drivers/iommu/intel/dmar.c
+++ b/drivers/iommu/intel/dmar.c
@@ -1144,7 +1144,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
 
 		err = iommu_device_register(&iommu->iommu);
 		if (err)
-			goto err_unmap;
+			goto err_sysfs;
 	}
 
 	drhd->iommu = iommu;
@@ -1152,6 +1152,8 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
 
 	return 0;
 
+err_sysfs:
+	iommu_device_sysfs_remove(&iommu->iommu);
 err_unmap:
 	unmap_iommu(iommu);
 error_free_seq_id:
-- 
2.31.1

-- 
Rolf Eike Beer, emlix GmbH, https://www.emlix.com
Fon +49 551 30664-0, Fax +49 551 30664-11
Gothaer Platz 3, 37083 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055

emlix - smart embedded open source



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

* Re: [PATCH] iommu/vt-d: Fix sysfs leak in alloc_domain()
  2021-04-22  5:34   ` Lu Baolu
@ 2021-05-21  6:53     ` Rolf Eike Beer
  2021-05-21  7:02       ` Lu Baolu
  0 siblings, 1 reply; 6+ messages in thread
From: Rolf Eike Beer @ 2021-05-21  6:53 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon, Lu Baolu
  Cc: baolu.lu, David Woodhouse, iommu, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 838 bytes --]

Am Donnerstag, 22. April 2021, 07:34:17 CEST schrieb Lu Baolu:
> Hi Rolf,
> 
> On 4/22/21 1:39 PM, Rolf Eike Beer wrote:
> > iommu_device_sysfs_add() is called before, so is has to be cleaned on
> > subsequent errors.
> > 
> > Fixes: 39ab9555c2411 ("iommu: Add sysfs bindings for struct iommu_device")
> > Cc: stable@vger.kernel.org # 4.11.x
> > Signed-off-by: Rolf Eike Beer <eb@emlix.com>
> 
> Acked-by: Lu Baolu <baolu.lu@linux.intel.com>

Ping. Who is going to pick this up, please?

Eike
-- 
Rolf Eike Beer, emlix GmbH, http://www.emlix.com
Fon +49 551 30664-0, Fax +49 551 30664-11
Gothaer Platz 3, 37083 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055

emlix - smart embedded open source

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 313 bytes --]

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

* Re: [PATCH] iommu/vt-d: Fix sysfs leak in alloc_domain()
  2021-05-21  6:53     ` Rolf Eike Beer
@ 2021-05-21  7:02       ` Lu Baolu
  0 siblings, 0 replies; 6+ messages in thread
From: Lu Baolu @ 2021-05-21  7:02 UTC (permalink / raw)
  To: Rolf Eike Beer, Joerg Roedel, Will Deacon
  Cc: baolu.lu, David Woodhouse, iommu, linux-kernel

Hi Joerg,

On 5/21/21 2:53 PM, Rolf Eike Beer wrote:
> Am Donnerstag, 22. April 2021, 07:34:17 CEST schrieb Lu Baolu:
>> Hi Rolf,
>>
>> On 4/22/21 1:39 PM, Rolf Eike Beer wrote:
>>> iommu_device_sysfs_add() is called before, so is has to be cleaned on
>>> subsequent errors.
>>>
>>> Fixes: 39ab9555c2411 ("iommu: Add sysfs bindings for struct iommu_device")
>>> Cc: stable@vger.kernel.org # 4.11.x
>>> Signed-off-by: Rolf Eike Beer <eb@emlix.com>
>>
>> Acked-by: Lu Baolu <baolu.lu@linux.intel.com>
> 
> Ping. Who is going to pick this up, please?

I forgot to put this fix in my last pull request. Could you please pick
it up? Or, I can send another pull request the next week.

Best regards,
baolu

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

end of thread, other threads:[~2021-05-21  7:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 15:12 [PATCH] Intel IOMMU: fix sysfs leak in hotplug init path Rolf Eike Beer
2021-04-22  2:46 ` Lu Baolu
2021-04-22  5:39 ` [PATCH] iommu/vt-d: Fix sysfs leak in alloc_domain() Rolf Eike Beer
2021-04-22  5:34   ` Lu Baolu
2021-05-21  6:53     ` Rolf Eike Beer
2021-05-21  7:02       ` Lu Baolu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).