public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu: amd: Added value check
@ 2022-11-18  9:44 Denis Arefev
  0 siblings, 0 replies; 3+ messages in thread
From: Denis Arefev @ 2022-11-18  9:44 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: Will Deacon, iommu, linux-kernel, lvc-project, trufanov, vfh

Аdded a return value check for the function
mmu_notifier_register.

Return value of a function 'mmu_notifier_register'
called at iommu_v2.c:642 is not checked,
 but it is usually checked for this function

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
 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 5ecc0bc608ec..88134f34589f 100644
--- a/drivers/iommu/amd/iommu_v2.c
+++ b/drivers/iommu/amd/iommu_v2.c
@@ -639,7 +639,9 @@ int amd_iommu_bind_pasid(struct pci_dev *pdev, u32 pasid,
 	if (pasid_state->mm == NULL)
 		goto out_free;
 
-	mmu_notifier_register(&pasid_state->mn, mm);
+	ret = mmu_notifier_register(&pasid_state->mn, mm);
+	if (ret)
+		goto out_free;
 
 	ret = set_pasid_state(dev_state, pasid_state, pasid);
 	if (ret)
-- 
2.25.1


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

* [PATCH] iommu: amd: Added value check
@ 2022-11-18 10:42 Denis Arefev
  2022-11-19 10:00 ` Joerg Roedel
  0 siblings, 1 reply; 3+ messages in thread
From: Denis Arefev @ 2022-11-18 10:42 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: Will Deacon, iommu, linux-kernel, lvc-project, trufanov, vfh

Аdded a return value check for the function
mmu_notifier_register.

Return value of a function 'mmu_notifier_register'
called at iommu_v2.c:642 is not checked,
 but it is usually checked for this function

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
 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 5ecc0bc608ec..88134f34589f 100644
--- a/drivers/iommu/amd/iommu_v2.c
+++ b/drivers/iommu/amd/iommu_v2.c
@@ -639,7 +639,9 @@ int amd_iommu_bind_pasid(struct pci_dev *pdev, u32 pasid,
 	if (pasid_state->mm == NULL)
 		goto out_free;
 
-	mmu_notifier_register(&pasid_state->mn, mm);
+	ret = mmu_notifier_register(&pasid_state->mn, mm);
+	if (ret)
+		goto out_free;
 
 	ret = set_pasid_state(dev_state, pasid_state, pasid);
 	if (ret)
-- 
2.25.1


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

* Re: [PATCH] iommu: amd: Added value check
  2022-11-18 10:42 [PATCH] iommu: amd: Added value check Denis Arefev
@ 2022-11-19 10:00 ` Joerg Roedel
  0 siblings, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2022-11-19 10:00 UTC (permalink / raw)
  To: Denis Arefev; +Cc: Will Deacon, iommu, linux-kernel, lvc-project, trufanov, vfh

On Fri, Nov 18, 2022 at 01:42:52PM +0300, Denis Arefev wrote:
> Аdded a return value check for the function
> mmu_notifier_register.
> 
> Return value of a function 'mmu_notifier_register'
> called at iommu_v2.c:642 is not checked,
>  but it is usually checked for this function
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Denis Arefev <arefev@swemel.ru>
> ---
>  drivers/iommu/amd/iommu_v2.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Applied, thanks.

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

end of thread, other threads:[~2022-11-19 10:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-18 10:42 [PATCH] iommu: amd: Added value check Denis Arefev
2022-11-19 10:00 ` Joerg Roedel
  -- strict thread matches above, loose matches on Subject: below --
2022-11-18  9:44 Denis Arefev

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